summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-08-24 17:00:37 +0100
committerErik Johnston <erik@matrix.org>2018-08-24 17:00:37 +0100
commit9db24769914f5c9a3081f549cbff92ef96042578 (patch)
tree5eb84f8afc267ba3af4199e3da3f9a4d17bbdb0b
parentNewsfile (diff)
parentMerge pull request #3756 from matrix-org/erikj/fix_tags_server_notices (diff)
downloadsynapse-9db24769914f5c9a3081f549cbff92ef96042578.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/admin_contact
-rw-r--r--changelog.d/3756.bugfix1
-rw-r--r--synapse/server_notices/resource_limits_server_notices.py7
-rw-r--r--tests/server_notices/test_resource_limits_server_notices.py1
3 files changed, 5 insertions, 4 deletions
diff --git a/changelog.d/3756.bugfix b/changelog.d/3756.bugfix
new file mode 100644
index 0000000000..6a1f83f0ce
--- /dev/null
+++ b/changelog.d/3756.bugfix
@@ -0,0 +1 @@
+Fix tagging of server notice rooms
diff --git a/synapse/server_notices/resource_limits_server_notices.py b/synapse/server_notices/resource_limits_server_notices.py
index c584c8f907..af15cba0ee 100644
--- a/synapse/server_notices/resource_limits_server_notices.py
+++ b/synapse/server_notices/resource_limits_server_notices.py
@@ -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:
diff --git a/tests/server_notices/test_resource_limits_server_notices.py b/tests/server_notices/test_resource_limits_server_notices.py
index 494a7bc91e..5cc7fff39b 100644
--- a/tests/server_notices/test_resource_limits_server_notices.py
+++ b/tests/server_notices/test_resource_limits_server_notices.py
@@ -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