mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 15:21:24 +01:00
add constructor for users service
This commit is contained in:
parent
f771d319b2
commit
e06d126d4e
2 changed files with 9 additions and 8 deletions
|
|
@ -1,7 +1,4 @@
|
|||
use std::{
|
||||
collections::BTreeMap,
|
||||
sync::{Arc, Mutex as StdMutex, OnceLock},
|
||||
};
|
||||
use std::sync::{Arc, OnceLock};
|
||||
|
||||
use crate::{observability::FilterReloadHandles, Config, Result};
|
||||
|
||||
|
|
@ -173,10 +170,7 @@ impl Services {
|
|||
},
|
||||
transaction_ids: db,
|
||||
uiaa: uiaa::Service::new(db),
|
||||
users: users::Service {
|
||||
db,
|
||||
connections: StdMutex::new(BTreeMap::new()),
|
||||
},
|
||||
users: users::Service::new(db),
|
||||
account_data: db,
|
||||
admin: admin::Service::build(),
|
||||
key_backups: db,
|
||||
|
|
|
|||
|
|
@ -46,6 +46,13 @@ pub(crate) struct Service {
|
|||
}
|
||||
|
||||
impl Service {
|
||||
pub(crate) fn new(db: &'static dyn Data) -> Self {
|
||||
Self {
|
||||
db,
|
||||
connections: Mutex::new(BTreeMap::new()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if a user has an account on this homeserver.
|
||||
pub(crate) fn exists(&self, user_id: &UserId) -> Result<bool> {
|
||||
self.db.exists(user_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue