1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-11-09 06:11:04 +01:00

Rename admin command CountUsers -> CountLocalUsers; Update comments

This commit is contained in:
Torsten Flammiger 2021-12-26 12:04:38 +01:00
parent 2281bcefc6
commit 39787b41cb
2 changed files with 7 additions and 7 deletions

View file

@ -13,7 +13,7 @@ use tracing::warn;
pub enum AdminCommand {
RegisterAppservice(serde_yaml::Value),
ListAppservices,
CountUsers,
CountLocalUsers,
SendMessage(RoomMessageEventContent),
}
@ -94,14 +94,14 @@ impl Admin {
let state_lock = mutex_state.lock().await;
match event {
AdminCommand::CountUsers => {
// count() does not return an error on failure...
AdminCommand::CountLocalUsers => {
// count_local_users() only returns with OK(x) where x is the number of found accounts
if let Ok(usercount) = guard.users.count_local_users() {
let message = format!("Found {} total user accounts", usercount);
let message = format!("Found {} local user account(s)", usercount);
send_message(RoomMessageEventContent::text_plain(message), guard, &state_lock);
} else {
// ... so we simply spit out a generic non-explaining-info in case count() did not return Ok()
send_message(RoomMessageEventContent::text_plain("Unable to count users"), guard, &state_lock);
// if count_local_users() only returns with OK(x), then why is this? ;-)
send_message(RoomMessageEventContent::text_plain("Unable to count local users"), guard, &state_lock);
}
}
AdminCommand::RegisterAppservice(yaml) => {

View file

@ -1532,7 +1532,7 @@ impl Rooms {
db.admin.send(AdminCommand::ListAppservices);
}
"count_local_users" => {
db.admin.send(AdminCommand::CountUsers);
db.admin.send(AdminCommand::CountLocalUsers);
}
"get_auth_chain" => {
if args.len() == 1 {