summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-09-07 23:28:42 +1000
committerGitHub <noreply@github.com>2018-09-07 23:28:42 +1000
commit9a5ea511b5ce2c8d782c11a2d57461661324b3d6 (patch)
tree633758768ef39f1d3861e4967f5f2786c126e0ac
parentMerge pull request #3783 from cwmke/develop (diff)
parentNewsfile (diff)
downloadsynapse-9a5ea511b5ce2c8d782c11a2d57461661324b3d6.tar.xz
Merge pull request #3810 from matrix-org/erikj/send_tags_down_sync_on_join
Send existing room tags down sync on join
-rw-r--r--changelog.d/3810.bugfix1
-rw-r--r--synapse/handlers/sync.py13
2 files changed, 14 insertions, 0 deletions
diff --git a/changelog.d/3810.bugfix b/changelog.d/3810.bugfix
new file mode 100644
index 0000000000..2b938a81ae
--- /dev/null
+++ b/changelog.d/3810.bugfix
@@ -0,0 +1 @@
+Fix existing room tags not coming down sync when joining a room
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index 9f133ded3f..7eed2fcc9b 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -1575,6 +1575,19 @@ class SyncHandler(object):
             newly_joined_room=newly_joined,
         )
 
+        # When we join the room (or the client requests full_state), we should
+        # send down any existing tags. Usually the user won't have tags in a
+        # newly joined room, unless either a) they've joined before or b) the
+        # tag was added by synapse e.g. for server notice rooms.
+        if full_state:
+            user_id = sync_result_builder.sync_config.user.to_string()
+            tags = yield self.store.get_tags_for_room(user_id, room_id)
+
+            # If there aren't any tags, don't send the empty tags list down
+            # sync
+            if not tags:
+                tags = None
+
         account_data_events = []
         if tags is not None:
             account_data_events.append({