pull stuff out of globals

This commit is contained in:
dasha_uwu
2025-09-23 02:37:31 +05:00
committed by Jason Volk
parent 6bb101ac51
commit 89a67af607
17 changed files with 83 additions and 221 deletions

View File

@@ -185,7 +185,7 @@ pub async fn create_admin_room(services: &Services) -> Result {
.await?;
// 6. Room alias
let alias = &services.globals.admin_alias;
let alias = &services.admin.admin_alias;
services
.timeline

View File

@@ -12,7 +12,7 @@ use async_trait::async_trait;
pub use create::create_admin_room;
use futures::{Future, FutureExt, TryFutureExt};
use ruma::{
OwnedEventId, OwnedRoomId, RoomId, UserId,
OwnedEventId, OwnedRoomAliasId, OwnedRoomId, RoomId, UserId,
events::room::message::{Relation, RoomMessageEventContent},
};
use tokio::sync::{RwLock, mpsc};
@@ -27,6 +27,7 @@ pub struct Service {
channel: StdRwLock<Option<mpsc::Sender<CommandInput>>>,
pub handle: RwLock<Option<Processor>>,
pub complete: StdRwLock<Option<Completer>>,
pub admin_alias: OwnedRoomAliasId,
#[cfg(feature = "console")]
pub console: Arc<console::Console>,
}
@@ -69,6 +70,8 @@ impl crate::Service for Service {
channel: StdRwLock::new(None),
handle: RwLock::new(None),
complete: StdRwLock::new(None),
admin_alias: OwnedRoomAliasId::try_from(format!("#admins:{}", &args.server.name))
.expect("#admins:server_name is valid alias name"),
#[cfg(feature = "console")]
console: console::Console::new(args),
}))
@@ -234,7 +237,7 @@ impl Service {
let room_id = self
.services
.alias
.resolve_local_alias(&self.services.globals.admin_alias)
.resolve_local_alias(&self.admin_alias)
.await?;
self.services