mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 13:49:52 -07:00
Support adding rooms to spaces (#407)
This commit is contained in:
parent
7dd09e32a8
commit
3e45ca3d2c
7 changed files with 366 additions and 5 deletions
|
@ -66,6 +66,7 @@ use crate::base::{
|
|||
RoomAction,
|
||||
RoomField,
|
||||
SendAction,
|
||||
SpaceAction,
|
||||
};
|
||||
|
||||
use self::chat::ChatState;
|
||||
|
@ -214,6 +215,18 @@ impl RoomState {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn space_command(
|
||||
&mut self,
|
||||
act: SpaceAction,
|
||||
ctx: ProgramContext,
|
||||
store: &mut ProgramStore,
|
||||
) -> IambResult<EditInfo> {
|
||||
match self {
|
||||
RoomState::Space(space) => space.space_command(act, ctx, store).await,
|
||||
RoomState::Chat(_) => Err(IambError::NoSelectedSpace.into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn send_command(
|
||||
&mut self,
|
||||
act: SendAction,
|
||||
|
@ -464,6 +477,9 @@ impl RoomState {
|
|||
RoomField::Aliases => {
|
||||
// This never happens, aliases is only used for showing
|
||||
},
|
||||
RoomField::Id => {
|
||||
// This never happens, id is only used for showing
|
||||
},
|
||||
}
|
||||
|
||||
Ok(vec![])
|
||||
|
@ -559,6 +575,9 @@ impl RoomState {
|
|||
RoomField::Aliases => {
|
||||
// This will not happen, you cannot unset all aliases
|
||||
},
|
||||
RoomField::Id => {
|
||||
// This never happens, id is only used for showing
|
||||
},
|
||||
}
|
||||
|
||||
Ok(vec![])
|
||||
|
@ -574,6 +593,10 @@ impl RoomState {
|
|||
let visibility = room.history_visibility();
|
||||
format!("Room history visibility: {visibility}")
|
||||
},
|
||||
RoomField::Id => {
|
||||
let id = room.room_id();
|
||||
format!("Room identifier: {id}")
|
||||
},
|
||||
RoomField::Name => {
|
||||
match room.name() {
|
||||
None => "Room has no name".into(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue