diff options
author | Mark Haines <mjark@negativecurvature.net> | 2015-11-03 16:45:53 +0000 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2015-11-03 16:45:53 +0000 |
commit | 6797fcd9aba8cb9d4f2bf36a5b26846cca684b31 (patch) | |
tree | 919e47f9b059936785ce21a04001ef1454b5faef /synapse/handlers/message.py | |
parent | Merge pull request #338 from matrix-org/daniel/fixdb (diff) | |
parent | That TODO was done (diff) | |
download | synapse-6797fcd9aba8cb9d4f2bf36a5b26846cca684b31.tar.xz |
Merge pull request #335 from matrix-org/markjh/room_tags
Add APIs for adding and removing tags from rooms
Diffstat (limited to 'synapse/handlers/message.py')
-rw-r--r-- | synapse/handlers/message.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 024474d5fe..0f947993d1 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -322,6 +322,8 @@ class MessageHandler(BaseHandler): user, pagination_config.get_source_config("receipt"), None ) + tags_by_room = yield self.store.get_tags_for_user(user_id) + public_room_ids = yield self.store.get_public_room_ids() limit = pagin_config.limit @@ -398,6 +400,15 @@ class MessageHandler(BaseHandler): serialize_event(c, time_now, as_client_event) for c in current_state.values() ] + + private_user_data = [] + tags = tags_by_room.get(event.room_id) + if tags: + private_user_data.append({ + "type": "m.tag", + "content": {"tags": tags}, + }) + d["private_user_data"] = private_user_data except: logger.exception("Failed to get snapshot") @@ -447,6 +458,16 @@ class MessageHandler(BaseHandler): result = yield self._room_initial_sync_parted( user_id, room_id, pagin_config, member_event ) + + private_user_data = [] + tags = yield self.store.get_tags_for_room(user_id, room_id) + if tags: + private_user_data.append({ + "type": "m.tag", + "content": {"tags": tags}, + }) + result["private_user_data"] = private_user_data + defer.returnValue(result) @defer.inlineCallbacks @@ -476,8 +497,8 @@ class MessageHandler(BaseHandler): user_id, messages ) - start_token = StreamToken(token[0], 0, 0, 0) - end_token = StreamToken(token[1], 0, 0, 0) + start_token = StreamToken(token[0], 0, 0, 0, 0) + end_token = StreamToken(token[1], 0, 0, 0, 0) time_now = self.clock.time_msec() |