diff options
author | David Robertson <davidr@element.io> | 2021-12-07 17:42:11 +0000 |
---|---|---|
committer | David Robertson <davidr@element.io> | 2021-12-07 18:26:35 +0000 |
commit | a5deabbaae534449ef0570bdba135dda98c04959 (patch) | |
tree | 58d0540df6f87b036dae4b66d6479162a710ee3c | |
parent | Always call `old_mem_ev`---exactly once. (diff) | |
download | synapse-a5deabbaae534449ef0570bdba135dda98c04959.tar.xz |
Remove check on `events[-1].membership`
I claim this check is redundant, because said membership cannot be join. If not, we'd have `continue`d above because `room_id` would be in `sync_result_builder.joined_room_ids`.
-rw-r--r-- | synapse/handlers/sync.py | 12 |
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 |