diff options
author | David Robertson <davidr@element.io> | 2021-12-07 11:24:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-07 11:24:31 +0000 |
commit | 9c55dedc8c4484e6269451a8c3c10b3e314aeb4a (patch) | |
tree | 5822724828b608fe2d4503a884f853a14f053efc | |
parent | Fix the test breakage introduced by #11435 as a result of concurrent PRs (#11... (diff) | |
download | synapse-9c55dedc8c4484e6269451a8c3c10b3e314aeb4a.tar.xz |
Correctly ignore invites from ignored users (#11511)
-rw-r--r-- | changelog.d/11511.bugfix | 1 | ||||
-rw-r--r-- | synapse/handlers/sync.py | 11 |
2 files changed, 7 insertions, 5 deletions
diff --git a/changelog.d/11511.bugfix b/changelog.d/11511.bugfix new file mode 100644 index 0000000000..9c287357b8 --- /dev/null +++ b/changelog.d/11511.bugfix @@ -0,0 +1 @@ +Fix a long-standing bug where invites from ignored users were included in incremental syncs. \ No newline at end of file diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 53d4627147..97d5a26e20 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -1771,6 +1771,7 @@ class SyncHandler: 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. @@ -1792,18 +1793,18 @@ class SyncHandler: 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) |