summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
Diffstat (limited to 'synapse')
-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",