summary refs log tree commit diff
path: root/synapse/handlers/federation.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/federation.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/federation.py')
-rw-r--r--synapse/handlers/federation.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 663d05c633..cd3867ed9c 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -239,22 +239,28 @@ class FederationHandler(BaseHandler):
                 return event
 
             history = state.get((EventTypes.RoomHistoryVisibility, ''), None)
-            if history and history.content.get("visibility", None) == "after_join":
-                for ev in state.values():
-                    if ev.type != EventTypes.Member:
-                        continue
-                    try:
-                        domain = UserID.from_string(ev.state_key).domain
-                    except:
-                        continue
+            if history:
+                visibility = history.content.get("history_visibility", "shared")
+                if visibility in ["invited", "joined"]:
+                    for ev in state.values():
+                        if ev.type != EventTypes.Member:
+                            continue
+                        try:
+                            domain = UserID.from_string(ev.state_key).domain
+                        except:
+                            continue
 
-                    if domain != server_name:
-                        continue
+                        if domain != server_name:
+                            continue
 
-                    if ev.membership == Membership.JOIN:
-                        return event
-                else:
-                    return prune_event(event)
+                        memtype = ev.membership
+                        if memtype == Membership.JOIN:
+                            return event
+                        elif memtype == Membership.INVITE:
+                            if visibility == "invited":
+                                return event
+                    else:
+                        return prune_event(event)
 
             return event