Skip to content

Commit

Permalink
Fix issue with newly joined room detection
Browse files Browse the repository at this point in the history
It is possible that the latest state event retrieved is the very same
join event present in the membership changes being processed, in this
case we treat this as a new join.
  • Loading branch information
Fizzadar committed Mar 28, 2022
1 parent 831d479 commit a9a6ed9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,9 @@ async def _get_rooms_changed(
old_state_ids = await self.get_state_at(room_id, since_token)
old_mem_ev_id = old_state_ids.get((EventTypes.Member, user_id), None)
old_mem_ev = None
if old_mem_ev_id:
# It is possible that the old membership event is the same as the
# latest change event we are handling, see `self.get_state_at`.
if old_mem_ev_id and old_mem_ev_id != events[-1].event_id:
old_mem_ev = await self.store.get_event(
old_mem_ev_id, allow_none=True
)
Expand Down

0 comments on commit a9a6ed9

Please sign in to comment.