1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-11-09 06:01:05 +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 { pub enum AdminCommand {
RegisterAppservice(serde_yaml::Value), RegisterAppservice(serde_yaml::Value),
ListAppservices, ListAppservices,
CountUsers, CountLocalUsers,
SendMessage(RoomMessageEventContent), SendMessage(RoomMessageEventContent),
} }
@ -94,14 +94,14 @@ impl Admin {
let state_lock = mutex_state.lock().await; let state_lock = mutex_state.lock().await;
match event { match event {
AdminCommand::CountUsers => { AdminCommand::CountLocalUsers => {
// count() does not return an error on failure... // 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() { 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); send_message(RoomMessageEventContent::text_plain(message), guard, &state_lock);
} else { } else {
// ... so we simply spit out a generic non-explaining-info in case count() did not return Ok() // if count_local_users() only returns with OK(x), then why is this? ;-)
send_message(RoomMessageEventContent::text_plain("Unable to count users"), guard, &state_lock); send_message(RoomMessageEventContent::text_plain("Unable to count local users"), guard, &state_lock);
} }
} }
AdminCommand::RegisterAppservice(yaml) => { AdminCommand::RegisterAppservice(yaml) => {

View file

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