events: Rename HierarchySpaceChildStateEvent => HierarchySpaceChildEvent

This commit is contained in:
Jonas Platte 2022-03-30 16:27:56 +02:00
parent 5ac6fcabc8
commit 9f56e6e497
No known key found for this signature in database
GPG Key ID: BBA95679259D342F
4 changed files with 14 additions and 14 deletions

View File

@ -6,7 +6,7 @@
use js_int::UInt; use js_int::UInt;
use ruma_common::{ use ruma_common::{
events::space::child::HierarchySpaceChildStateEvent, events::space::child::HierarchySpaceChildEvent,
room::RoomType, room::RoomType,
serde::{Raw, StringEnum}, serde::{Raw, StringEnum},
MxcUri, RoomAliasId, RoomId, RoomName, MxcUri, RoomAliasId, RoomId, RoomName,
@ -75,7 +75,7 @@ pub struct SpaceHierarchyRoomsChunk {
/// The stripped `m.space.child` events of the space-room. /// The stripped `m.space.child` events of the space-room.
/// ///
/// If the room is not a space-room, this should be empty. /// If the room is not a space-room, this should be empty.
pub children_state: Vec<Raw<HierarchySpaceChildStateEvent>>, pub children_state: Vec<Raw<HierarchySpaceChildEvent>>,
} }
/// Initial set of mandatory fields of `SpaceHierarchyRoomsChunk`. /// Initial set of mandatory fields of `SpaceHierarchyRoomsChunk`.
@ -105,7 +105,7 @@ pub struct SpaceHierarchyRoomsChunkInit {
/// The stripped `m.space.child` events of the space-room. /// The stripped `m.space.child` events of the space-room.
/// ///
/// If the room is not a space-room, this should be empty. /// If the room is not a space-room, this should be empty.
pub children_state: Vec<Raw<HierarchySpaceChildStateEvent>>, pub children_state: Vec<Raw<HierarchySpaceChildEvent>>,
} }
impl From<SpaceHierarchyRoomsChunkInit> for SpaceHierarchyRoomsChunk { impl From<SpaceHierarchyRoomsChunkInit> for SpaceHierarchyRoomsChunk {

View File

@ -55,7 +55,7 @@ impl SpaceChildEventContent {
/// key. /// key.
#[derive(Clone, Debug, Event)] #[derive(Clone, Debug, Event)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct HierarchySpaceChildStateEvent { pub struct HierarchySpaceChildEvent {
/// The content of the space child event. /// The content of the space child event.
pub content: SpaceChildEventContent, pub content: SpaceChildEventContent,
@ -76,7 +76,7 @@ mod tests {
use matches::assert_matches; use matches::assert_matches;
use serde_json::{from_value as from_json_value, json, to_value as to_json_value}; use serde_json::{from_value as from_json_value, json, to_value as to_json_value};
use super::{HierarchySpaceChildStateEvent, SpaceChildEventContent}; use super::{HierarchySpaceChildEvent, SpaceChildEventContent};
#[test] #[test]
fn space_child_serialization() { fn space_child_serialization() {
@ -106,7 +106,7 @@ mod tests {
#[test] #[test]
fn hierarchy_space_child_serialization() { fn hierarchy_space_child_serialization() {
let event = HierarchySpaceChildStateEvent { let event = HierarchySpaceChildEvent {
content: SpaceChildEventContent { content: SpaceChildEventContent {
via: Some(vec![server_name!("example.com").to_owned()]), via: Some(vec![server_name!("example.com").to_owned()]),
order: Some("uwu".to_owned()), order: Some("uwu".to_owned()),
@ -146,8 +146,8 @@ mod tests {
}); });
assert_matches!( assert_matches!(
from_json_value::<HierarchySpaceChildStateEvent>(json).unwrap(), from_json_value::<HierarchySpaceChildEvent>(json).unwrap(),
HierarchySpaceChildStateEvent { HierarchySpaceChildEvent {
content: SpaceChildEventContent { content: SpaceChildEventContent {
via: Some(via), via: Some(via),
order: None, order: None,

View File

@ -2,8 +2,8 @@
use js_int::UInt; use js_int::UInt;
use ruma_common::{ use ruma_common::{
directory::PublicRoomJoinRule, events::space::child::HierarchySpaceChildStateEvent, directory::PublicRoomJoinRule, events::space::child::HierarchySpaceChildEvent, room::RoomType,
room::RoomType, serde::Raw, MxcUri, RoomAliasId, RoomId, RoomName, serde::Raw, MxcUri, RoomAliasId, RoomId, RoomName,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -67,7 +67,7 @@ pub struct SpaceHierarchyParentSummary {
/// The stripped `m.space.child` events of the space-room. /// The stripped `m.space.child` events of the space-room.
/// ///
/// If the room is not a space-room, this should be empty. /// If the room is not a space-room, this should be empty.
pub children_state: Vec<Raw<HierarchySpaceChildStateEvent>>, pub children_state: Vec<Raw<HierarchySpaceChildEvent>>,
/// If the room is a restricted room, these are the room IDs which are specified by the join /// If the room is a restricted room, these are the room IDs which are specified by the join
/// rules. /// rules.
@ -102,7 +102,7 @@ pub struct SpaceHierarchyParentSummaryInit {
/// The stripped `m.space.child` events of the space-room. /// The stripped `m.space.child` events of the space-room.
/// ///
/// If the room is not a space-room, this should be empty. /// If the room is not a space-room, this should be empty.
pub children_state: Vec<Raw<HierarchySpaceChildStateEvent>>, pub children_state: Vec<Raw<HierarchySpaceChildEvent>>,
/// If the room is a restricted room, these are the room IDs which are specified by the join /// If the room is a restricted room, these are the room IDs which are specified by the join
/// rules. /// rules.

View File

@ -100,7 +100,7 @@ impl fmt::Display for EventKind {
EventKind::ToDevice => write!(f, "ToDeviceEvent"), EventKind::ToDevice => write!(f, "ToDeviceEvent"),
EventKind::RoomRedaction => write!(f, "RoomRedactionEvent"), EventKind::RoomRedaction => write!(f, "RoomRedactionEvent"),
EventKind::Presence => write!(f, "PresenceEvent"), EventKind::Presence => write!(f, "PresenceEvent"),
EventKind::HierarchySpaceChild => write!(f, "HierarchySpaceChildStateEvent"), EventKind::HierarchySpaceChild => write!(f, "HierarchySpaceChildEvent"),
EventKind::Decrypted => unreachable!(), EventKind::Decrypted => unreachable!(),
} }
} }
@ -214,7 +214,7 @@ pub fn to_kind_variation(ident: &Ident) -> Option<(EventKind, EventKindVariation
"RedactedSyncStateEvent" => Some((EventKind::State, EventKindVariation::RedactedSync)), "RedactedSyncStateEvent" => Some((EventKind::State, EventKindVariation::RedactedSync)),
"ToDeviceEvent" => Some((EventKind::ToDevice, EventKindVariation::Full)), "ToDeviceEvent" => Some((EventKind::ToDevice, EventKindVariation::Full)),
"PresenceEvent" => Some((EventKind::Presence, EventKindVariation::Full)), "PresenceEvent" => Some((EventKind::Presence, EventKindVariation::Full)),
"HierarchySpaceChildStateEvent" => { "HierarchySpaceChildEvent" => {
Some((EventKind::HierarchySpaceChild, EventKindVariation::Stripped)) Some((EventKind::HierarchySpaceChild, EventKindVariation::Stripped))
} }
"RoomRedactionEvent" => Some((EventKind::RoomRedaction, EventKindVariation::Full)), "RoomRedactionEvent" => Some((EventKind::RoomRedaction, EventKindVariation::Full)),