diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-12-04 17:32:09 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-12-04 17:32:09 +0000 |
commit | 660dee94afdcb1059cb7074f1428fbfaa8c57465 (patch) | |
tree | 54a003ae2494d9b27b5f8dfac2cc5f364adb9ff4 /synapse | |
parent | Merge pull request #420 from matrix-org/markjh/resource_usage (diff) | |
download | synapse-660dee94afdcb1059cb7074f1428fbfaa8c57465.tar.xz |
Only include the archived rooms if a include_leave flag in set in the filter
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/api/filtering.py | 4 | ||||
-rw-r--r-- | synapse/handlers/sync.py | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py index 19f30c273c..bc03d6c287 100644 --- a/synapse/api/filtering.py +++ b/synapse/api/filtering.py @@ -143,6 +143,10 @@ class FilterCollection(object): self.filter_json.get("account_data", {}) ) + self.include_leave = self.filter_json.get("room", {}).get( + "include_leave", False + ) + def timeline_limit(self): return self.room_timeline_filter.limit() diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 943ce368ef..24c2b2fad6 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -186,14 +186,14 @@ class SyncHandler(BaseHandler): pagination_config=pagination_config.get_source_config("presence"), key=None ) + + membership_list = (Membership.INVITE, Membership.JOIN) + if sync_config.filter.include_leave: + membership_list += (Membership.LEAVE, Membership.BAN) + room_list = yield self.store.get_rooms_for_user_where_membership_is( user_id=sync_config.user.to_string(), - membership_list=( - Membership.INVITE, - Membership.JOIN, - Membership.LEAVE, - Membership.BAN - ) + membership_list=membership_list ) account_data, account_data_by_room = ( |