From 2cc72de80e66da0605aa63f8a4303b5b808973db Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 9 Apr 2024 02:09:25 -0700 Subject: [PATCH] fix lossy origin regression 12a8c9badd20 Signed-off-by: Jason Volk --- src/api/client_server/sync.rs | 1 + src/service/pdu.rs | 2 ++ src/service/rooms/timeline/mod.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/src/api/client_server/sync.rs b/src/api/client_server/sync.rs index 8f31d4dc..bcaad1d9 100644 --- a/src/api/client_server/sync.rs +++ b/src/api/client_server/sync.rs @@ -304,6 +304,7 @@ async fn sync_helper( let event = PduEvent { event_id: EventId::new(services().globals.server_name()).into(), sender: sender_user.clone(), + origin: None, origin_server_ts: utils::millis_since_unix_epoch() .try_into() .expect("Timestamp is valid js_int value"), diff --git a/src/service/pdu.rs b/src/service/pdu.rs index e4b8deae..6dc965ff 100644 --- a/src/service/pdu.rs +++ b/src/service/pdu.rs @@ -32,6 +32,8 @@ pub struct PduEvent { pub event_id: Arc, pub room_id: OwnedRoomId, pub sender: OwnedUserId, + #[serde(skip_serializing_if = "Option::is_none")] + pub origin: Option, pub origin_server_ts: UInt, #[serde(rename = "type")] pub kind: TimelineEventType, diff --git a/src/service/rooms/timeline/mod.rs b/src/service/rooms/timeline/mod.rs index ad6a10e6..2b0571c3 100644 --- a/src/service/rooms/timeline/mod.rs +++ b/src/service/rooms/timeline/mod.rs @@ -719,6 +719,7 @@ impl Service { event_id: ruma::event_id!("$thiswillbefilledinlater").into(), room_id: room_id.to_owned(), sender: sender.to_owned(), + origin: None, origin_server_ts: utils::millis_since_unix_epoch() .try_into() .expect("time is valid"),