diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 300cdff82041..212186b1cee3 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -1981,7 +1981,7 @@ async def _get_room_changes_for_incremental_sync( for event in membership_change_events: mem_change_events_by_room_id.setdefault(event.room_id, []).append(event) - newly_joined_rooms: List[str] = [] + newly_joined_rooms: List[str] = list(sync_result_builder.retransmit_room_ids) newly_left_rooms: List[str] = [] room_entries: List[RoomSyncResultBuilder] = [] invited: List[InvitedSyncResult] = [] @@ -2004,9 +2004,7 @@ async def _get_room_changes_for_incremental_sync( # we do send down the room, and with full state, where necessary old_state_ids = None - if room_id in sync_result_builder.joined_room_ids and ( - non_joins or room_id in sync_result_builder.retransmit_room_ids - ): + if room_id in sync_result_builder.joined_room_ids and non_joins: # Always include if the user (re)joined the room, especially # important so that device list changes are calculated correctly. # If there are non-join member events, but we are still in the room,