Support adding rooms to spaces (#407)

This commit is contained in:
VAWVAW 2025-05-15 03:26:35 +00:00 committed by GitHub
parent 7dd09e32a8
commit 3e45ca3d2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 366 additions and 5 deletions

View file

@ -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(),