client-api: Move SpaceRoomJoinRule to ruma-common
This commit is contained in:
parent
c77f08024a
commit
86b999055e
@ -5,6 +5,7 @@ Breaking changes:
|
||||
- Define `rank` as an `Option<f64>` instead of an `Option<UInt>` in
|
||||
`search::search_events::v3::SearchResult`
|
||||
- Remove the `token` field from `keys::get_keys::Request`, according to a spec clarification.
|
||||
- `SpaceRoomJoinRule` has been moved to the `space` module of the ruma-common crate
|
||||
|
||||
Improvements:
|
||||
|
||||
|
@ -6,15 +6,11 @@
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma_common::{
|
||||
events::space::child::HierarchySpaceChildEvent,
|
||||
room::RoomType,
|
||||
serde::{Raw, StringEnum},
|
||||
OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId,
|
||||
events::space::child::HierarchySpaceChildEvent, room::RoomType, serde::Raw,
|
||||
space::SpaceRoomJoinRule, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::PrivOwnedStr;
|
||||
|
||||
pub mod get_hierarchy;
|
||||
|
||||
/// A chunk of a space hierarchy response, describing one room.
|
||||
@ -135,45 +131,3 @@ impl From<SpaceHierarchyRoomsChunkInit> for SpaceHierarchyRoomsChunk {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The rule used for users wishing to join a room.
|
||||
///
|
||||
/// In contrast to the regular [`JoinRule`](ruma_common::events::room::join_rules::JoinRule), this
|
||||
/// enum does not hold the conditions for joining restricted rooms. Instead, the server is assumed
|
||||
/// to only return rooms the user is allowed to join in a space hierarchy listing response.
|
||||
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
|
||||
#[derive(Clone, Default, PartialEq, Eq, StringEnum)]
|
||||
#[ruma_enum(rename_all = "snake_case")]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub enum SpaceRoomJoinRule {
|
||||
/// A user who wishes to join the room must first receive an invite to the room from someone
|
||||
/// already inside of the room.
|
||||
Invite,
|
||||
|
||||
/// Users can join the room if they are invited, or they can request an invite to the room.
|
||||
///
|
||||
/// They can be allowed (invited) or denied (kicked/banned) access.
|
||||
Knock,
|
||||
|
||||
/// Reserved but not yet implemented by the Matrix specification.
|
||||
Private,
|
||||
|
||||
/// Users can join the room if they are invited, or if they meet any of the conditions
|
||||
/// described in a set of [`AllowRule`](ruma_common::events::room::join_rules::AllowRule)s.
|
||||
///
|
||||
/// These rules are not made available as part of a space hierarchy listing response and can
|
||||
/// only be seen by users inside the room.
|
||||
Restricted,
|
||||
|
||||
/// Users can join the room if they are invited, or if they meet any of the conditions
|
||||
/// described in a set of [`AllowRule`](ruma_common::events::room::join_rules::AllowRule)s, or
|
||||
/// they can request an invite to the room.
|
||||
KnockRestricted,
|
||||
|
||||
/// Anyone can join the room without any prior action.
|
||||
#[default]
|
||||
Public,
|
||||
|
||||
#[doc(hidden)]
|
||||
_Custom(PrivOwnedStr),
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ pub mod presence;
|
||||
pub mod push;
|
||||
pub mod room;
|
||||
pub mod serde;
|
||||
pub mod space;
|
||||
pub mod thirdparty;
|
||||
mod time;
|
||||
pub mod to_device;
|
||||
|
49
crates/ruma-common/src/space.rs
Normal file
49
crates/ruma-common/src/space.rs
Normal file
@ -0,0 +1,49 @@
|
||||
//! Common types for [spaces].
|
||||
//!
|
||||
//! [spaces]: https://spec.matrix.org/latest/client-server-api/#spaces
|
||||
|
||||
use ruma_macros::StringEnum;
|
||||
|
||||
use crate::PrivOwnedStr;
|
||||
|
||||
/// The rule used for users wishing to join a room.
|
||||
///
|
||||
/// In contrast to the regular [`JoinRule`](crate::events::room::join_rules::JoinRule), this
|
||||
/// enum does not hold the conditions for joining restricted rooms. Instead, the server is assumed
|
||||
/// to only return rooms the user is allowed to join in a space hierarchy listing response.
|
||||
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
|
||||
#[derive(Clone, Default, PartialEq, Eq, StringEnum)]
|
||||
#[ruma_enum(rename_all = "snake_case")]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub enum SpaceRoomJoinRule {
|
||||
/// A user who wishes to join the room must first receive an invite to the room from someone
|
||||
/// already inside of the room.
|
||||
Invite,
|
||||
|
||||
/// Users can join the room if they are invited, or they can request an invite to the room.
|
||||
///
|
||||
/// They can be allowed (invited) or denied (kicked/banned) access.
|
||||
Knock,
|
||||
|
||||
/// Reserved but not yet implemented by the Matrix specification.
|
||||
Private,
|
||||
|
||||
/// Users can join the room if they are invited, or if they meet any of the conditions
|
||||
/// described in a set of [`AllowRule`](crate::events::room::join_rules::AllowRule)s.
|
||||
///
|
||||
/// These rules are not made available as part of a space hierarchy listing response and can
|
||||
/// only be seen by users inside the room.
|
||||
Restricted,
|
||||
|
||||
/// Users can join the room if they are invited, or if they meet any of the conditions
|
||||
/// described in a set of [`AllowRule`](crate::events::room::join_rules::AllowRule)s, or
|
||||
/// they can request an invite to the room.
|
||||
KnockRestricted,
|
||||
|
||||
/// Anyone can join the room without any prior action.
|
||||
#[default]
|
||||
Public,
|
||||
|
||||
#[doc(hidden)]
|
||||
_Custom(PrivOwnedStr),
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user