Skip to content

Commit

Permalink
special case server_notices_mxid
Browse files Browse the repository at this point in the history
  • Loading branch information
neilisfragile committed Aug 18, 2018
1 parent d49b774 commit ba1fbf7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion synapse/server_notices/resource_limits_server_notices.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _is_room_currently_blocked(self, room_id):
referenced_events = pinned_state_event.content.get('pinned')

events = yield self._store.get_events(referenced_events)
for event_id, event in events.iteritems():
for event_id, event in iteritems(events):
if event.type == EventTypes.ServerNoticeLimitReached:
currently_blocked = True
# remove event in case we need to disable blocking later on.
Expand Down
8 changes: 8 additions & 0 deletions tests/api/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,11 @@ def test_hs_disabled(self):
self.assertEquals(e.exception.admin_uri, self.hs.config.admin_uri)
self.assertEquals(e.exception.errcode, Codes.RESOURCE_LIMIT_EXCEED)
self.assertEquals(e.exception.code, 403)

@defer.inlineCallbacks
def test_server_notices_mxid_special_cased(self):
self.hs.config.hs_disabled = True
user = "@user:server"
self.hs.config.server_notices_mxid = user
self.hs.config.hs_disabled_message = "Reason for being disabled"
yield self.auth.check_auth_blocking(user)

0 comments on commit ba1fbf7

Please sign in to comment.