mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-13 12:16:54 +00:00
fix(sync): Verify state for newly-left rooms is in incremental sync
This commit is contained in:
1 parent
4f1af01bdc
commit
b144b18aef
2 files changed
+16
-1
No files matched your search
@@ -0,0 +1 @@
|
||||
Fixed freshly left room failing to sync.
|
||||
@@ -230,7 +230,7 @@ async fn build_left_state_and_timeline(
|
||||
.and_then(|limit| limit.try_into().ok())
|
||||
.unwrap_or(DEFAULT_TIMELINE_LIMIT);
|
||||
|
||||
let timeline = load_timeline(
|
||||
let mut timeline = load_timeline(
|
||||
services,
|
||||
syncing_user,
|
||||
room_id,
|
||||
@@ -240,6 +240,20 @@ async fn build_left_state_and_timeline(
|
||||
)
|
||||
.await?;
|
||||
|
||||
// the timeline index can lag behind the leave PDU, so `load_timeline` may omit
|
||||
// it. we already hold the leave event, so ensure it's always synced to the
|
||||
// client.
|
||||
let leave_synced = timeline
|
||||
.pdus
|
||||
.iter()
|
||||
.any(|(_, pdu)| pdu.event_id() == leave_membership_event.event_id());
|
||||
|
||||
if !leave_synced {
|
||||
timeline
|
||||
.pdus
|
||||
.push_back((timeline_end_count, leave_membership_event));
|
||||
}
|
||||
|
||||
let lazily_loaded_members =
|
||||
prepare_lazily_loaded_members(services, sync_context, room_id, timeline.senders()).await;
|
||||
|
||||
|
||||
Reference in new issue
Block a user