allow no event_id in predecessor like synapse

Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
June Clementine Strawberry 2025-04-02 19:37:23 -04:00
parent 7c97c2b1a2
commit ea12786571

View file

@ -115,12 +115,15 @@ pub struct PreviousRoom {
pub room_id: OwnedRoomId,
/// The event ID of the last known event in the old room.
pub event_id: OwnedEventId,
/// conduwuit makes this optional because Synapse allows an empty event_id
/// and there are no issues with this.
#[serde(skip_serializing_if = "Option::is_none")]
pub event_id: Option<OwnedEventId>,
}
impl PreviousRoom {
/// Creates a new `PreviousRoom` from the given room and event IDs.
pub fn new(room_id: OwnedRoomId, event_id: OwnedEventId) -> Self {
pub fn new(room_id: OwnedRoomId, event_id: Option<OwnedEventId>) -> Self {
Self { room_id, event_id }
}
}