refactor: Fix errors in api/client/sync

This commit is contained in:
Ginger
2026-04-10 13:48:35 -04:00
parent 01e403f05f
commit 4e456249ac
7 changed files with 208 additions and 198 deletions
+11 -10
View File
@@ -7,7 +7,10 @@ use conduwuit::{
use futures::{StreamExt, future::join};
use ruma::{
EventId, OwnedRoomId, RoomId,
api::client::sync::sync_events::v3::{LeftRoom, RoomAccountData, State, Timeline},
api::client::sync::sync_events::v3::{
LeftRoom, RoomAccountData, State, StateEvents, Timeline,
},
assign,
events::{StateEventType, TimelineEventType},
uint,
};
@@ -178,17 +181,15 @@ pub(super) async fn load_left_room(
.collect::<Vec<_>>()
.await;
Ok(Some(LeftRoom {
account_data: RoomAccountData { events: Vec::new() },
timeline: Timeline {
Ok(Some(assign!(LeftRoom::new(), {
account_data: RoomAccountData::new(),
timeline: assign!(Timeline::new(), {
limited: timeline.limited,
prev_batch: Some(current_count.to_string()),
events: raw_timeline_pdus,
},
state: State {
events: state_events.into_iter().map(Event::into_format).collect(),
},
}))
}),
state: State::Before(StateEvents::with_events(state_events.into_iter().map(Event::into_format).collect())),
})))
}
async fn build_left_state_and_timeline(
@@ -317,7 +318,7 @@ fn create_dummy_leave_event(
// clients. perhaps a database table could be created to hold these dummy
// events, or they could be stored as outliers?
PduEvent {
event_id: EventId::new(services.globals.server_name()),
event_id: EventId::new_v1(services.globals.server_name()),
sender: syncing_user.to_owned(),
origin: None,
origin_server_ts: utils::millis_since_unix_epoch()