summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/handlers/sync.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index fc2562cd7b..967f88c52f 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -1878,15 +1878,11 @@ class SyncHandler:
             # 2. Should we add this to `newly_left_rooms`?
             # Check if we have left the room. This can either be because we were
             # joined before *or* that we since joined and then left.
-            if events[-1].membership != Membership.JOIN:
-                if has_join:
+            if has_join:
+                newly_left_rooms.append(room_id)
+            else:
+                if old_mem_ev is not None and old_mem_ev.membership == Membership.JOIN:
                     newly_left_rooms.append(room_id)
-                else:
-                    if (
-                        old_mem_ev is not None
-                        and old_mem_ev.membership == Membership.JOIN
-                    ):
-                        newly_left_rooms.append(room_id)
 
             # 3. Should we add this room to `invited`?
             # Only bother if we're still currently invited