Rename admin command CountUsers -> CountLocalUsers; Update comments

merge-requests/254/head
Torsten Flammiger 3 years ago
parent 2281bcefc6
commit 39787b41cb

@ -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) => {

@ -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 {

Loading…
Cancel
Save