summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-08-24 15:04:41 +0100
committerGitHub <noreply@github.com>2018-08-24 15:04:41 +0100
commit897d976c1e3ea4dc350d7fb499fe800d855944cf (patch)
treeaf2caadcc69c4018976cb210ae427d09d454d584
parentMerge pull request #3754 from matrix-org/erikj/fix_whitelist (diff)
parentNewsfile (diff)
downloadsynapse-897d976c1e3ea4dc350d7fb499fe800d855944cf.tar.xz
Merge pull request #3755 from matrix-org/erikj/fix_server_notice_tags hhs-2
Fix up tagging server notice rooms.
-rw-r--r--changelog.d/3755.bugfix1
-rw-r--r--synapse/server_notices/resource_limits_server_notices.py9
-rw-r--r--synapse/server_notices/server_notices_manager.py10
3 files changed, 16 insertions, 4 deletions
diff --git a/changelog.d/3755.bugfix b/changelog.d/3755.bugfix
new file mode 100644
index 0000000000..6a1f83f0ce
--- /dev/null
+++ b/changelog.d/3755.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 98495ddbf9..893b9001cd 100644
--- a/synapse/server_notices/resource_limits_server_notices.py
+++ b/synapse/server_notices/resource_limits_server_notices.py
@@ -46,6 +46,8 @@ class ResourceLimitsServerNotices(object):
         self._message_handler = hs.get_message_handler()
         self._state = hs.get_state_handler()
 
+        self._notifier = hs.get_notifier()
+
     @defer.inlineCallbacks
     def maybe_send_server_notice_to_user(self, user_id):
         """Check if we need to send a notice to this user, this will be true in
@@ -152,8 +154,11 @@ class ResourceLimitsServerNotices(object):
                 # tag already present, nothing to do here
                 need_to_set_tag = False
         if need_to_set_tag:
-            yield self._store.add_tag_to_room(
-                user_id, room_id, SERVER_NOTICE_ROOM_TAG, None
+            max_id = yield self._store.add_tag_to_room(
+                user_id, room_id, SERVER_NOTICE_ROOM_TAG, {}
+            )
+            self._notifier.on_new_event(
+                "account_data_key", max_id, users=[user_id]
             )
 
     @defer.inlineCallbacks
diff --git a/synapse/server_notices/server_notices_manager.py b/synapse/server_notices/server_notices_manager.py
index 5968104a99..c5cc6d728e 100644
--- a/synapse/server_notices/server_notices_manager.py
+++ b/synapse/server_notices/server_notices_manager.py
@@ -39,6 +39,8 @@ class ServerNoticesManager(object):
         self._event_creation_handler = hs.get_event_creation_handler()
         self._is_mine_id = hs.is_mine_id
 
+        self._notifier = hs.get_notifier()
+
     def is_enabled(self):
         """Checks if server notices are enabled on this server.
 
@@ -153,8 +155,12 @@ class ServerNoticesManager(object):
             creator_join_profile=join_profile,
         )
         room_id = info['room_id']
-        yield self._store.add_tag_to_room(
-            user_id, room_id, SERVER_NOTICE_ROOM_TAG, None
+
+        max_id = yield self._store.add_tag_to_room(
+            user_id, room_id, SERVER_NOTICE_ROOM_TAG, {},
+        )
+        self._notifier.on_new_event(
+            "account_data_key", max_id, users=[user_id]
         )
 
         logger.info("Created server notices room %s for %s", room_id, user_id)