diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2019-01-18 15:12:47 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2019-01-22 11:00:04 +0000 |
commit | ea8903fcc904c88027bcec62dc6646377941db41 (patch) | |
tree | a486cf561e5d12ca02a5d29580beb5c59350f375 /synapse | |
parent | Prevent crash on user who doesn't have any direct rooms (diff) | |
download | synapse-ea8903fcc904c88027bcec62dc6646377941db41.tar.xz |
Migrating dm and room tags work for migrator
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/room.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 626c9f9166..07cf5f3f18 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -260,12 +260,16 @@ class RoomCreationHandler(BaseHandler): } } - # Copy over whether this room is considered a direct message by this - # user or not + # Copy over room account data for this user user_account_data = yield self.store.get_account_data_for_user( user_id, ) + room_tags = yield self.store.get_tags_for_room( + user_id, old_room_id, + ) + + # Copy direct message state if applicable if user_account_data and "m.direct" in user_account_data[0]: direct_rooms = user_account_data[0]["m.direct"] # Check if this room was a DM @@ -278,6 +282,13 @@ class RoomCreationHandler(BaseHandler): user_id, "m.direct", direct_rooms, ) + # Copy room tags if applicable + if room_tags: + # Copy each room tag to the new room + for tag in room_tags.keys(): + tag_content = room_tags[tag] + yield self.store.add_tag_to_room(user_id, new_room_id, tag, tag_content) + initial_state = dict() # Replicate relevant room events |