summary refs log tree commit diff
path: root/synapse/handlers/room_member.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2017-10-03 14:17:44 +0100
committerDavid Baker <dave@matrix.org>2017-10-03 14:17:44 +0100
commit41fd9989a28cfd6cc0b401677be61270f3959cfa (patch)
tree5d33cd0a60f6a2a45018d51dc302493ddeda758f /synapse/handlers/room_member.py
parentFix param name & lint (diff)
downloadsynapse-41fd9989a28cfd6cc0b401677be61270f3959cfa.tar.xz
Skip spam check for admin users
Diffstat (limited to '')
-rw-r--r--synapse/handlers/room_member.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 61b0140e69..e88ba0e3a6 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -213,16 +213,16 @@ class RoomMemberHandler(BaseHandler):
 
         if effective_membership_state == "invite":
             block_invite = False
-            if self.hs.config.block_non_admin_invites:
-                is_requester_admin = yield self.auth.is_server_admin(
-                    requester.user,
-                )
-                if not is_requester_admin:
+            is_requester_admin = yield self.auth.is_server_admin(
+                requester.user,
+            )
+            if not is_requester_admin:
+                if (
+                    self.hs.config.block_non_admin_invites or
+                    not self.spam_checker.user_may_invite(requester.user)
+                ):
                     block_invite = True
 
-            if not self.spam_checker.user_may_invite(requester.user):
-                block_invite = True
-
             if block_invite:
                 raise SynapseError(
                     403, "Invites have been disabled on this server",