summary refs log tree commit diff
path: root/synapse/visibility.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2017-03-23 18:50:31 +0000
committerDavid Baker <dave@matrix.org>2017-03-23 18:50:31 +0000
commite1f1784f99dbb7815250e4963b6969230ea6e8d3 (patch)
tree9bafe48c19316502b63d6e822faad978dfaae74a /synapse/visibility.py
parentMerge pull request #1783 from pik/filter-validation (diff)
downloadsynapse-e1f1784f99dbb7815250e4963b6969230ea6e8d3.tar.xz
Fix rejection of invites not reaching sync
Always allow the user to see their own leave events, otherwise
they won't see the event if they reject an invite for a room whose
history visibility is set such that they cannot see events before
joining.
Diffstat (limited to 'synapse/visibility.py')
-rw-r--r--synapse/visibility.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/visibility.py b/synapse/visibility.py
index 199b16d827..31659156ae 100644
--- a/synapse/visibility.py
+++ b/synapse/visibility.py
@@ -134,6 +134,13 @@ def filter_events_for_clients(store, user_tuples, events, event_id_to_state):
             if prev_membership not in MEMBERSHIP_PRIORITY:
                 prev_membership = "leave"
 
+            # Always allow the user to see their own leave events, otherwise
+            # they won't see the room disappear if they reject the invite
+            if membership == "leave" and (
+                prev_membership == "join" or prev_membership == "invite"
+            ):
+                return True
+
             new_priority = MEMBERSHIP_PRIORITY.index(membership)
             old_priority = MEMBERSHIP_PRIORITY.index(prev_membership)
             if old_priority < new_priority: