diff --git a/lib/filter-component.js b/lib/filter-component.js index 8534d420d..35d21f380 100644 --- a/lib/filter-component.js +++ b/lib/filter-component.js @@ -40,13 +40,13 @@ function FilterComponent(filter_json) { this.types = filter_json.types || null; this.not_types = filter_json.not_types || []; - self.rooms = filter_json.rooms || null; - self.not_rooms = filter_json.not_rooms || []; + this.rooms = filter_json.rooms || null; + this.not_rooms = filter_json.not_rooms || []; - self.senders = filter_json.senders || null; - self.not_senders = filter_json.not_senders || []; + this.senders = filter_json.senders || null; + this.not_senders = filter_json.not_senders || []; - self.contains_url = filter_json.contains_url || null; + this.contains_url = filter_json.contains_url || null; }; /** diff --git a/lib/filter.js b/lib/filter.js index ff81d2fcd..2a4f0fb4f 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -113,7 +113,9 @@ Filter.prototype.setDefinition = function(definition) { } this._room_filter = new FilterComponent(room_filter_fields); - this._room_timeline_filter = new FilterComponent(room_filter_json.timeline || {}); + this._room_timeline_filter = new FilterComponent( + room_filter_json ? (room_filter_json.timeline || {}) : {} + ); // don't bother porting this from synapse yet: // this._room_state_filter = new FilterComponent(room_filter_json.state || {});