mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix(sync/v3): Do not include the last membership event when syncing left rooms
This commit is contained in:
@@ -39,6 +39,7 @@ impl TimelinePdus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Load up to `limit` PDUs in the range (starting_count, ending_count].
|
||||||
async fn load_timeline(
|
async fn load_timeline(
|
||||||
services: &Services,
|
services: &Services,
|
||||||
sender_user: &UserId,
|
sender_user: &UserId,
|
||||||
|
|||||||
@@ -137,20 +137,21 @@ pub(super) async fn load_left_room(
|
|||||||
// if the user went from `join` to `leave`, they should be able to view the
|
// if the user went from `join` to `leave`, they should be able to view the
|
||||||
// timeline.
|
// timeline.
|
||||||
|
|
||||||
let timeline_start_count = if let Some(last_sync_end_count) =
|
let timeline_start_count =
|
||||||
last_sync_end_count
|
if let Some(last_sync_end_count) = last_sync_end_count {
|
||||||
{
|
// for incremental syncs, start the timeline after `since`
|
||||||
// for incremental syncs, start the timeline after `since`
|
PduCount::Normal(last_sync_end_count)
|
||||||
PduCount::Normal(last_sync_end_count)
|
} else {
|
||||||
} else {
|
// for initial syncs, start the timeline after the previous membership
|
||||||
// for initial syncs, start the timeline at the previous membership event
|
// event. we don't want to include the membership event itself
|
||||||
services
|
// because clients get confused when they see a `join`
|
||||||
.rooms
|
// membership event in a `leave` room.
|
||||||
.timeline
|
services
|
||||||
.get_pdu_count(&prev_member_event.event_id)
|
.rooms
|
||||||
.await?
|
.timeline
|
||||||
.saturating_sub(1)
|
.get_pdu_count(&prev_member_event.event_id)
|
||||||
};
|
.await?
|
||||||
|
};
|
||||||
|
|
||||||
// end the timeline at the user's leave event
|
// end the timeline at the user's leave event
|
||||||
let timeline_end_count = services
|
let timeline_end_count = services
|
||||||
|
|||||||
Reference in New Issue
Block a user