summary refs log tree commit diff
path: root/synapse/handlers/sync.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-07-06 13:05:52 +0100
committerErik Johnston <erik@matrix.org>2015-07-06 13:05:52 +0100
commitfb47c3cfbe213c01b25e5605b81c998b764e2bf8 (patch)
treec69bc9fc5c3845b9db9d1324f6a4b17cb1ebe985 /synapse/handlers/sync.py
parentFilter and redact events that the other server doesn't have permission to see... (diff)
downloadsynapse-fb47c3cfbe213c01b25e5605b81c998b764e2bf8.tar.xz
Rename key and values for m.room.history_visibility. Support 'invited' value
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r--synapse/handlers/sync.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 5078c4e45e..6cff6230c1 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -306,16 +306,31 @@ class SyncHandler(BaseHandler):
             if event.type == EventTypes.RoomHistoryVisibility:
                 return True
 
-            membership = state.get((EventTypes.Member, user_id), None)
-            if membership and membership.membership == Membership.JOIN:
+            membership_ev = state.get((EventTypes.Member, user_id), None)
+            if membership_ev:
+                membership = membership_ev.membership
+            else:
+                membership = Membership.LEAVE
+
+            if membership == Membership.JOIN:
                 return True
 
             history = state.get((EventTypes.RoomHistoryVisibility, ''), None)
-            if history and history.content.get("visibility", None) == "after_join":
-                return False
+            if history:
+                visibility = history.content.get("history_visibility", "shared")
+            else:
+                visibility = "shared"
 
-            return True
+            if visibility == "public":
+                return True
+            elif visibility == "shared":
+                return True
+            elif visibility == "joined":
+                return membership == Membership.JOIN
+            elif visibility == "invited":
+                return membership == Membership.INVITE
 
+            return True
         events_and_states = filter(allowed, events_and_states)
         defer.returnValue([
             ev