summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-01-30 16:23:28 +0000
committerRichard van der Hoff <richard@matrix.org>2019-01-30 16:23:28 +0000
commitc74b96755cdd60ac7ca6e2dd925f901220abf437 (patch)
treee6c44730a2d6bade40c16e699f9b0f209153ff1c
parentACME Upgrade Docs (#4528) (diff)
parentMerge pull request #4527 from matrix-org/erikj/fix_sending_remote_invite_reje... (diff)
downloadsynapse-c74b96755cdd60ac7ca6e2dd925f901220abf437.tar.xz
Merge remote-tracking branch 'origin/develop' into release-v0.99.0
-rw-r--r--changelog.d/4527.bugfix1
-rw-r--r--synapse/handlers/sync.py14
2 files changed, 14 insertions, 1 deletions
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
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,