summary refs log tree commit diff
path: root/synapse/event_auth.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-12-18 09:51:51 +0000
committerRichard van der Hoff <richard@matrix.org>2019-12-18 09:51:51 +0000
commit6e8f8e14f272a5de61de675f6a01a5e1fc834c41 (patch)
tree5cc934c1e024e101cde67f698ee5b957101942b3 /synapse/event_auth.py
parentRemove unused `get_pagination_rows` methods. (#6557) (diff)
parentFix bug where we added duplicate event IDs as auth_events (#6560) (diff)
downloadsynapse-6e8f8e14f272a5de61de675f6a01a5e1fc834c41.tar.xz
Merge release-v1.7.1 into develop
Diffstat (limited to 'synapse/event_auth.py')
-rw-r--r--synapse/event_auth.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/synapse/event_auth.py b/synapse/event_auth.py
index 80ec911b3d..1033e5e121 100644
--- a/synapse/event_auth.py
+++ b/synapse/event_auth.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 import logging
+from typing import Set, Tuple
 
 from canonicaljson import encode_canonical_json
 from signedjson.key import decode_verify_key_bytes
@@ -633,7 +634,7 @@ def get_public_keys(invite_event):
     return public_keys
 
 
-def auth_types_for_event(event):
+def auth_types_for_event(event) -> Set[Tuple[str]]:
     """Given an event, return a list of (EventType, StateKey) that may be
     needed to auth the event. The returned list may be a superset of what
     would actually be required depending on the full state of the room.
@@ -642,20 +643,20 @@ def auth_types_for_event(event):
     actually auth the event.
     """
     if event.type == EventTypes.Create:
-        return []
+        return set()
 
-    auth_types = [
+    auth_types = {
         (EventTypes.PowerLevels, ""),
         (EventTypes.Member, event.sender),
         (EventTypes.Create, ""),
-    ]
+    }
 
     if event.type == EventTypes.Member:
         membership = event.content["membership"]
         if membership in [Membership.JOIN, Membership.INVITE]:
-            auth_types.append((EventTypes.JoinRules, ""))
+            auth_types.add((EventTypes.JoinRules, ""))
 
-        auth_types.append((EventTypes.Member, event.state_key))
+        auth_types.add((EventTypes.Member, event.state_key))
 
         if membership == Membership.INVITE:
             if "third_party_invite" in event.content:
@@ -663,6 +664,6 @@ def auth_types_for_event(event):
                     EventTypes.ThirdPartyInvite,
                     event.content["third_party_invite"]["signed"]["token"],
                 )
-                auth_types.append(key)
+                auth_types.add(key)
 
     return auth_types