diff --git a/crates/ruma-client-api/CHANGELOG.md b/crates/ruma-client-api/CHANGELOG.md index ed9fa07e..cbdee709 100644 --- a/crates/ruma-client-api/CHANGELOG.md +++ b/crates/ruma-client-api/CHANGELOG.md @@ -19,6 +19,10 @@ Bug fixes: - Rename `avatar` to `avatar_url` when (De)serializing +Bug fixes: + +- `user_id` of `SlidingSyncRoomHero` is now mandatory + # 0.18.0 Bug fixes: diff --git a/crates/ruma-client-api/src/sync/sync_events/v4.rs b/crates/ruma-client-api/src/sync/sync_events/v4.rs index 7873f76c..2a6a56c6 100644 --- a/crates/ruma-client-api/src/sync/sync_events/v4.rs +++ b/crates/ruma-client-api/src/sync/sync_events/v4.rs @@ -504,12 +504,11 @@ impl SlidingSyncRoom { } /// A sliding sync room hero. -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct SlidingSyncRoomHero { /// The user ID of the hero. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_id: Option, + pub user_id: OwnedUserId, /// The name of the hero. #[serde(rename = "displayname", skip_serializing_if = "Option::is_none")] @@ -520,6 +519,13 @@ pub struct SlidingSyncRoomHero { pub avatar: Option, } +impl SlidingSyncRoomHero { + /// Creates a new `SlidingSyncRoomHero` with the given user id. + pub fn new(user_id: OwnedUserId) -> Self { + Self { user_id, name: None, avatar: None } + } +} + /// Sliding-Sync extension configuration. #[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]