events: Move space events from unstable-pre-spec to unstable-spec

This commit is contained in:
Jonas Platte 2022-02-01 22:02:23 +01:00
parent 2706f24688
commit f46c7a643f
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
6 changed files with 17 additions and 15 deletions

View File

@ -73,9 +73,9 @@ event_enum! {
"m.room.third_party_invite", "m.room.third_party_invite",
"m.room.tombstone", "m.room.tombstone",
"m.room.topic", "m.room.topic",
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
"m.space.child", "m.space.child",
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
"m.space.parent", "m.space.parent",
} }

View File

@ -175,7 +175,7 @@ pub mod room;
pub mod room_key; pub mod room_key;
pub mod room_key_request; pub mod room_key_request;
pub mod secret; pub mod secret;
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
pub mod space; pub mod space;
pub mod sticker; pub mod sticker;
pub mod tag; pub mod tag;

View File

@ -45,7 +45,7 @@ pub struct RoomCreateEventContent {
/// The room type. /// The room type.
/// ///
/// This is currently only used for spaces. /// This is currently only used for spaces.
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
#[serde(skip_serializing_if = "Option::is_none", rename = "type")] #[serde(skip_serializing_if = "Option::is_none", rename = "type")]
pub room_type: Option<RoomType>, pub room_type: Option<RoomType>,
} }
@ -58,7 +58,7 @@ impl RoomCreateEventContent {
federate: true, federate: true,
room_version: default_room_version_id(), room_version: default_room_version_id(),
predecessor: None, predecessor: None,
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
room_type: None, room_type: None,
} }
} }
@ -69,6 +69,7 @@ impl RoomCreateEventContent {
/// This type can hold an arbitrary string. To check for formats that are not available as a /// This type can hold an arbitrary string. To check for formats that are not available as a
/// documented variant here, use its string representation, obtained through `.as_str()`. /// documented variant here, use its string representation, obtained through `.as_str()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[cfg(feature = "unstable-spec")]
#[non_exhaustive] #[non_exhaustive]
pub enum RoomType { pub enum RoomType {
/// Defines the room as a space. /// Defines the room as a space.
@ -118,7 +119,7 @@ mod tests {
use super::RoomCreateEventContent; use super::RoomCreateEventContent;
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
use super::RoomType; use super::RoomType;
#[test] #[test]
@ -128,7 +129,7 @@ mod tests {
federate: false, federate: false,
room_version: RoomVersionId::V4, room_version: RoomVersionId::V4,
predecessor: None, predecessor: None,
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
room_type: None, room_type: None,
}; };
@ -141,7 +142,7 @@ mod tests {
assert_eq!(to_json_value(&content).unwrap(), json); assert_eq!(to_json_value(&content).unwrap(), json);
} }
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
#[test] #[test]
fn space_serialization() { fn space_serialization() {
let content = RoomCreateEventContent { let content = RoomCreateEventContent {
@ -177,7 +178,7 @@ mod tests {
federate: true, federate: true,
room_version: RoomVersionId::V4, room_version: RoomVersionId::V4,
predecessor: None, predecessor: None,
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-spec")]
room_type: None, room_type: None,
} if creator == "@carl:example.com" } if creator == "@carl:example.com"
); );

View File

@ -1,9 +1,6 @@
//! Types for the `m.space` events. //! Types for the `m.space` events.
//! //!
//! See [MSC2758] and [MSC1772]. //! See [the unstable specification](https://spec.matrix.org/unstable/client-server-api/#spaces).
//!
//! [MSC2758]: https://github.com/matrix-org/matrix-doc/blob/master/proposals/2758-textual-id-grammar.md
//! [MSC1772]: https://github.com/matrix-org/matrix-doc/blob/master/proposals/1772-groups-as-rooms.md
pub mod child; pub mod child;
pub mod parent; pub mod parent;

View File

@ -1,4 +1,6 @@
//! Types for the `m.space.child` event. //! Types for the [`m.space.child`] event.
//!
//! [`m.space.child`]: https://spec.matrix.org/unstable/client-server-api/#mspacechild
use ruma_events_macros::EventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::ServerName; use ruma_identifiers::ServerName;

View File

@ -1,4 +1,6 @@
//! Types for the `m.space.child` event. //! Types for the [`m.space.parent`] event.
//!
//! [`m.space.parent`]: https://spec.matrix.org/unstable/client-server-api/#mspaceparent
use ruma_events_macros::EventContent; use ruma_events_macros::EventContent;
use ruma_identifiers::ServerName; use ruma_identifiers::ServerName;