1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

actually filter /messages

This commit is contained in:
Matthew Hodgson
2016-09-07 22:04:12 +01:00
parent 91f8df8d19
commit dac820f957
2 changed files with 23 additions and 0 deletions

View File

@@ -1743,6 +1743,13 @@ MatrixClient.prototype.paginateEventTimeline = function(eventTimeline, opts) {
dir: dir dir: dir
}; };
var filter = eventTimeline.getFilter();
if (filter) {
// XXX: it's horrific that /messages' filter parameter doesn't match
// /sync's one - see https://matrix.org/jira/browse/SPEC-451
params.filter = JSON.stringify(filter.getRoomTimelineFilterComponent());
}
var self = this; var self = this;
var promise = var promise =

View File

@@ -51,6 +51,14 @@ function Filter(userId, filterId) {
this.definition = {}; this.definition = {};
} }
/**
* Get the ID of this filter on your homeserver (if known)
* @return {?Number} The filter ID
*/
Filter.prototype.getFilterId = function() {
return this.filterId;
};
/** /**
* Get the JSON body of the filter. * Get the JSON body of the filter.
* @return {Object} The filter definition * @return {Object} The filter definition
@@ -126,6 +134,14 @@ Filter.prototype.setDefinition = function(definition) {
// this._account_data_filter = new FilterComponent(definition.account_data || {}); // this._account_data_filter = new FilterComponent(definition.account_data || {});
}; };
/**
* Get the room.timeline filter component of the filter
* @return {FilterComponent} room timeline filter component
*/
Filter.prototype.getRoomTimelineFilterComponent = function() {
return this._room_timeline_filter;
};
/** /**
* Filter the list of events based on whether they are allowed in a timeline * Filter the list of events based on whether they are allowed in a timeline
* based on this filter * based on this filter