summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-03-21 12:25:33 +0000
committerErik Johnston <erik@matrix.org>2019-03-21 12:48:37 +0000
commit164798ec32a30e07bd5972ec216e7848f0928c78 (patch)
tree498b115d9eb2b96c886087d85b6140df46cae412 /synapse/events
parentCorrectly handle 3PID invites in create room spam check (diff)
downloadsynapse-164798ec32a30e07bd5972ec216e7848f0928c78.tar.xz
Add 3PID invite support to spam checker
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/spamcheck.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/events/spamcheck.py b/synapse/events/spamcheck.py
index 87d66a9703..107c2e1f35 100644
--- a/synapse/events/spamcheck.py
+++ b/synapse/events/spamcheck.py
@@ -46,14 +46,19 @@ class SpamChecker(object):
 
         return self.spam_checker.check_event_for_spam(event)
 
-    def user_may_invite(self, inviter_userid, invitee_userid, room_id, new_room):
+    def user_may_invite(self, inviter_userid, invitee_userid, third_party_invite,
+                        room_id, new_room):
         """Checks if a given user may send an invite
 
         If this method returns false, the invite will be rejected.
 
         Args:
             inviter_userid (str)
-            invitee_userid (str)
+            invitee_userid (str|None): The user ID of the invitee. Is None
+                if this is a third party invite and the 3PID is not bound to a
+                user ID.
+            invitee_userid (dict|None): If a third party invite then is a dict
+                containing the medium and address of the invitee.
             room_id (str)
             new_room (bool): Wether the user is being invited to the room as
                 part of a room creation, if so the invitee would have been
@@ -66,7 +71,7 @@ class SpamChecker(object):
             return True
 
         return self.spam_checker.user_may_invite(
-            inviter_userid, invitee_userid, room_id, new_room,
+            inviter_userid, invitee_userid, third_party_invite, room_id, new_room,
         )
 
     def user_may_create_room(self, userid, invite_list, third_party_invite_list,