Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Remove check on events[-1].membership
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
David Robertson committed Dec 7, 2021
1 parent 0d0783c commit a5deabb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1878,15 +1878,11 @@ async def _classify_rooms_by_membership_changes(
# 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
Expand Down

0 comments on commit a5deabb

Please sign in to comment.