mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-17 14:13:50 +01:00
Prevent duplicate room IDs in m.direct
This commit is contained in:
parent
8086a5c05e
commit
c4875d8c76
1 changed files with 8 additions and 9 deletions
|
@ -248,16 +248,15 @@ class RoomMemberHandler(object):
|
||||||
|
|
||||||
# Check which key this room is under
|
# Check which key this room is under
|
||||||
for key, room_id_list in direct_rooms.items():
|
for key, room_id_list in direct_rooms.items():
|
||||||
for rid in room_id_list:
|
if old_room_id in room_id_list and room_id not in room_id_list:
|
||||||
if rid == old_room_id:
|
# Add new room_id to this key
|
||||||
# Add new room_id to this key
|
direct_rooms[key].append(room_id)
|
||||||
direct_rooms[key].append(room_id)
|
|
||||||
|
|
||||||
# Save back to user's m.direct account data
|
# Save back to user's m.direct account data
|
||||||
yield self.store.add_account_data_for_user(
|
yield self.store.add_account_data_for_user(
|
||||||
user_id, "m.direct", direct_rooms,
|
user_id, "m.direct", direct_rooms,
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
# Copy room tags if applicable
|
# Copy room tags if applicable
|
||||||
if room_tags:
|
if room_tags:
|
||||||
|
|
Loading…
Reference in a new issue