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

Commit

Permalink
Correctly ignore invites from ignored users (#11511)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Dec 7, 2021
1 parent 2d42e58 commit 9c55ded
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.d/11511.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a long-standing bug where invites from ignored users were included in incremental syncs.
11 changes: 6 additions & 5 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,7 @@ async def _get_rooms_changed(

if not non_joins:
continue
last_non_join = non_joins[-1]

# Check if we have left the room. This can either be because we were
# joined before *or* that we since joined and then left.
Expand All @@ -1792,18 +1793,18 @@ async def _get_rooms_changed(
newly_left_rooms.append(room_id)

# Only bother if we're still currently invited
should_invite = non_joins[-1].membership == Membership.INVITE
should_invite = last_non_join.membership == Membership.INVITE
if should_invite:
if event.sender not in ignored_users:
invite_room_sync = InvitedSyncResult(room_id, invite=non_joins[-1])
if last_non_join.sender not in ignored_users:
invite_room_sync = InvitedSyncResult(room_id, invite=last_non_join)
if invite_room_sync:
invited.append(invite_room_sync)

# Only bother if our latest membership in the room is knock (and we haven't
# been accepted/rejected in the meantime).
should_knock = non_joins[-1].membership == Membership.KNOCK
should_knock = last_non_join.membership == Membership.KNOCK
if should_knock:
knock_room_sync = KnockedSyncResult(room_id, knock=non_joins[-1])
knock_room_sync = KnockedSyncResult(room_id, knock=last_non_join)
if knock_room_sync:
knocked.append(knock_room_sync)

Expand Down

0 comments on commit 9c55ded

Please sign in to comment.