summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-04-22 18:33:36 +0100
committerDavid Baker <dave@matrix.org>2016-04-22 18:33:36 +0100
commitc5b3c6e1010ce55eda27b35f008819867c21bc51 (patch)
treee28065113cc3e65f4c61eba5b4a51b7968a8a8ae /synapse/util
parentMime part is binary so encode it first. (diff)
downloadsynapse-c5b3c6e1010ce55eda27b35f008819867c21bc51.tar.xz
Sort member events
So names of people in a room are given in order
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/room_name.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/util/room_name.py b/synapse/util/room_name.py
index 30b7291369..30ef77b9f8 100644
--- a/synapse/util/room_name.py
+++ b/synapse/util/room_name.py
@@ -73,6 +73,10 @@ def calculate_room_name(room_state, user_id):
             ev for ev in room_state_bytype["m.room.member"].values()
             if ev.content['membership'] == "join" or ev.content['membership'] == "invite"
         ]
+        # Sort the member events oldest-first so the we name people in the
+        # order the joined (it should at least be deterministic rather than
+        # dictionary iteration order)
+        all_members.sort(key=lambda e: e.origin_server_ts)
         other_members = [m for m in all_members if m.state_key != user_id]
     else:
         other_members = []