diff options
author | Mark Haines <mjark@negativecurvature.net> | 2015-12-01 18:42:59 +0000 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2015-12-01 18:42:59 +0000 |
commit | a2922bb9449999d31758f81f82e31ac9fa32208f (patch) | |
tree | a9e347f9249c0cea4c981bd854b7e731e2e23532 /synapse/handlers/account_data.py | |
parent | Merge pull request #407 from MadsRC/develop (diff) | |
parent | Add API for setting account_data globaly or on a per room basis (diff) | |
download | synapse-a2922bb9449999d31758f81f82e31ac9fa32208f.tar.xz |
Merge pull request #392 from matrix-org/markjh/client_config
Add API for setting per user account data at the top level or room level.
Diffstat (limited to 'synapse/handlers/account_data.py')
-rw-r--r-- | synapse/handlers/account_data.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/synapse/handlers/account_data.py b/synapse/handlers/account_data.py index 1d35d3b7dc..fe773bee9b 100644 --- a/synapse/handlers/account_data.py +++ b/synapse/handlers/account_data.py @@ -29,9 +29,10 @@ class AccountDataEventSource(object): last_stream_id = from_key current_stream_id = yield self.store.get_max_account_data_stream_id() - tags = yield self.store.get_updated_tags(user_id, last_stream_id) results = [] + tags = yield self.store.get_updated_tags(user_id, last_stream_id) + for room_id, room_tags in tags.items(): results.append({ "type": "m.tag", @@ -39,6 +40,24 @@ class AccountDataEventSource(object): "room_id": room_id, }) + account_data, room_account_data = ( + yield self.store.get_updated_account_data_for_user(user_id, last_stream_id) + ) + + for account_data_type, content in account_data.items(): + results.append({ + "type": account_data_type, + "content": content, + }) + + for room_id, account_data in room_account_data.items(): + for account_data_type, content in account_data.items(): + results.append({ + "type": account_data_type, + "content": content, + "room_id": room_id, + }) + defer.returnValue((results, current_stream_id)) @defer.inlineCallbacks |