tuwunel_admin/user/
force_join_room.rs1use ruma::OwnedRoomOrAliasId;
2use tuwunel_core::Result;
3
4use crate::{admin_command, utils::parse_local_user_id};
5
6#[admin_command]
7pub(super) async fn force_join_room(&self, user_id: String, room: OwnedRoomOrAliasId) -> Result {
8 let user_id = parse_local_user_id(self.services, &user_id)?;
9 let (room_id, servers) = self
10 .services
11 .alias
12 .maybe_resolve_with_servers(&room, None)
13 .await?;
14
15 assert!(
16 self.services.globals.user_is_local(&user_id),
17 "Parsed user_id must be a local user"
18 );
19
20 self.services
21 .membership
22 .join(&user_id, &room_id, Some(&room), None, &servers, false, None)
23 .await?;
24
25 write!(self, "{user_id} has been joined to {room_id}.").await
26}