Merge branch 'develop' of github.com:matrix-org/synapse into erikj/admin_contact

This commit is contained in:
Erik Johnston 2018-08-24 17:00:37 +01:00
commit 9db2476991
3 changed files with 5 additions and 4 deletions

1
changelog.d/3756.bugfix Normal file
View file

@ -0,0 +1 @@
Fix tagging of server notice rooms

View file

@ -146,11 +146,10 @@ class ResourceLimitsServerNotices(object):
user_id(str): the user in question
room_id(str): the server notices room for that user
"""
tags = yield self._store.get_tags_for_user(user_id)
server_notices_tags = tags.get(room_id)
tags = yield self._store.get_tags_for_room(user_id, room_id)
need_to_set_tag = True
if server_notices_tags:
if server_notices_tags.get(SERVER_NOTICE_ROOM_TAG):
if tags:
if SERVER_NOTICE_ROOM_TAG in tags:
# tag already present, nothing to do here
need_to_set_tag = False
if need_to_set_tag:

View file

@ -55,6 +55,7 @@ class TestResourceLimitsServerNotices(unittest.TestCase):
returnValue=""
)
self._rlsn._store.add_tag_to_room = Mock()
self._rlsn._store.get_tags_for_room = Mock(return_value={})
self.hs.config.admin_contact = "mailto:user@test.com"
@defer.inlineCallbacks