events: Use the default value of canonical in SpaceParentEventContent's constructor

This commit is contained in:
Kévin Commaille 2023-09-13 19:48:33 +02:00 committed by Kévin Commaille
parent 4dbda813c9
commit 2ad291ceb0

View File

@ -27,14 +27,16 @@ pub struct SpaceParentEventContent {
/// together. In practice, well behaved rooms should only have one `canonical` parent, but /// together. In practice, well behaved rooms should only have one `canonical` parent, but
/// given this is not enforced: if multiple are present the client should select the one with /// given this is not enforced: if multiple are present the client should select the one with
/// the lowest room ID, as determined via a lexicographic ordering of the Unicode code-points. /// the lowest room ID, as determined via a lexicographic ordering of the Unicode code-points.
///
/// Defaults to `false`.
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub canonical: bool, pub canonical: bool,
} }
impl SpaceParentEventContent { impl SpaceParentEventContent {
/// Creates a new `SpaceParentEventContent` with the given routing servers and canonical flag. /// Creates a new `SpaceParentEventContent` with the given routing servers.
pub fn new(via: Vec<OwnedServerName>, canonical: bool) -> Self { pub fn new(via: Vec<OwnedServerName>) -> Self {
Self { via, canonical } Self { via, canonical: false }
} }
} }