From c4c1d170afcc78eee8b0a9c65fac666b70598989 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 28 Nov 2017 15:19:15 +0000 Subject: [PATCH 1/3] Fix wrong avatars when inviting multiple users when creating room We reused the `content` dictionary between invite requests, which meant they could end up reusing the profile info for a previous user --- synapse/handlers/room.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 496f1fc39..6a0431ba7 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -205,12 +205,12 @@ class RoomCreationHandler(BaseHandler): }, ratelimit=False) - content = {} - is_direct = config.get("is_direct", None) - if is_direct: - content["is_direct"] = is_direct - for invitee in invite_list: + content = {} + is_direct = config.get("is_direct", None) + if is_direct: + content["is_direct"] = is_direct + yield room_member_handler.update_membership( requester, UserID.from_string(invitee), From dfbc45302ecac29f8dfad439135d9202d6dbfc51 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 28 Nov 2017 15:23:26 +0000 Subject: [PATCH 2/3] PEP8 --- synapse/handlers/room.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 6a0431ba7..d1cc87a01 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -210,7 +210,7 @@ class RoomCreationHandler(BaseHandler): is_direct = config.get("is_direct", None) if is_direct: content["is_direct"] = is_direct - + yield room_member_handler.update_membership( requester, UserID.from_string(invitee), From ef045dcd71147f50e0144bc896e0a59ee5303061 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 7 Dec 2017 14:17:15 +0000 Subject: [PATCH 3/3] Copy dict in update_membership too --- synapse/handlers/room_member.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index 970fec066..7e6467cd1 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -189,6 +189,10 @@ class RoomMemberHandler(BaseHandler): content_specified = bool(content) if content is None: content = {} + else: + # We do a copy here as we potentially change some keys + # later on. + content = dict(content) effective_membership_state = action if action in ["kick", "unban"]: