Move room_tag declaration to be closer to its use

This commit is contained in:
Andrew Morgan 2019-01-25 11:21:25 +00:00
parent 821b65aeb5
commit 6f3fda79ce

View file

@ -261,13 +261,10 @@ class RoomMemberHandler(object):
if "predecessor" in create_event["content"]: if "predecessor" in create_event["content"]:
old_room_id = create_event["content"]["predecessor"]["room_id"] old_room_id = create_event["content"]["predecessor"]["room_id"]
# Retrieve room account data for predecessor room # Retrieve user account data for predecessor room
user_account_data = yield self.store.get_account_data_for_user( user_account_data = yield self.store.get_account_data_for_user(
user_id, user_id,
) )
room_tags = yield self.store.get_tags_for_room(
user_id, old_room_id,
)
# Copy direct message state if applicable # Copy direct message state if applicable
if user_account_data and "m.direct" in user_account_data[0]: if user_account_data and "m.direct" in user_account_data[0]:
@ -286,6 +283,10 @@ class RoomMemberHandler(object):
break break
# Copy room tags if applicable # Copy room tags if applicable
room_tags = yield self.store.get_tags_for_room(
user_id, old_room_id,
)
if room_tags: if room_tags:
# Copy each room tag to the new room # Copy each room tag to the new room
for tag in room_tags.keys(): for tag in room_tags.keys():