From ed8c5e4cda75f120db32c313c7b24bd15659c5e3 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 30 Jan 2019 15:46:27 +0000 Subject: [PATCH 1/2] Fix remote invite rejections not comming down sync This was broken in PR #4405, commit 886e5ac, where we changed remote rejections to be outliers. The fix is to explicitly add the leave event in when we know its an out of band invite. We can't always add the event as if the server is/was in the room there might be more events to send down the sync than just the leave. --- synapse/handlers/sync.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index f7f768f751..28857bfc1c 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -1473,10 +1473,22 @@ class SyncHandler(object): if since_token and since_token.is_after(leave_token): continue + # If this is an out of band message, like a remote invite + # rejection, we include it in the recents batch. Otherwise, we + # let _load_filtered_recents handle fetching the correct + # batches. + # + # This is all screaming out for a refactor, as the logic here is + # subtle and the moving parts numerous. + if leave_event.internal_metadata.is_out_of_band_membership(): + batch_events = [leave_event] + else: + batch_events = None + room_entries.append(RoomSyncResultBuilder( room_id=room_id, rtype="archived", - events=None, + events=batch_events, newly_joined=room_id in newly_joined_rooms, full_state=False, since_token=since_token, From e25ab58c5e8d4ac640e405cdf59d93653e9a450b Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 30 Jan 2019 15:50:28 +0000 Subject: [PATCH 2/2] Newsfile --- changelog.d/4527.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/4527.bugfix diff --git a/changelog.d/4527.bugfix b/changelog.d/4527.bugfix new file mode 100644 index 0000000000..974d799b88 --- /dev/null +++ b/changelog.d/4527.bugfix @@ -0,0 +1 @@ +Fix bug when rejecting remote invites