From 0b1e24a9ade1cbb2dafe0fa82d22bfee664bf4ad Mon Sep 17 00:00:00 2001 From: Ginger Date: Sat, 11 Jul 2026 10:33:47 -0400 Subject: [PATCH] fix: Add admin command to ensure all appservice puppets are active --- docs/reference/admin/appservices.md | 4 ++++ docs/reference/admin/debug.md | 4 ++++ docs/reference/admin/query.md | 4 +--- src/admin/appservice/commands.rs | 25 +++++++++++++++++++++++++ src/admin/appservice/mod.rs | 6 ++++++ src/web/pages/oidc/complete.rs | 2 +- 6 files changed, 41 insertions(+), 4 deletions(-) diff --git a/docs/reference/admin/appservices.md b/docs/reference/admin/appservices.md index 8b3708e5e..3c2da88a0 100644 --- a/docs/reference/admin/appservices.md +++ b/docs/reference/admin/appservices.md @@ -27,3 +27,7 @@ ## `!admin appservices show-appservice-config` ## `!admin appservices list-registered` List all the currently registered appservices + +## `!admin appservices ensure-puppets-active` + +Ensure no appservice puppets are marked as deactivated. This is a debug command to fix issues caused by a faulty database migration in Continuwuity 26.6.0 diff --git a/docs/reference/admin/debug.md b/docs/reference/admin/debug.md index ea0d83bc2..b15507157 100644 --- a/docs/reference/admin/debug.md +++ b/docs/reference/admin/debug.md @@ -146,6 +146,10 @@ ## `!admin debug send-test-email` Send a test email to the invoking admin's email address +## `!admin debug rooms-by-extremity-count` + +Lists room IDs by forward extremity count in descending order + ## `!admin debug tester` Developer test stubs diff --git a/docs/reference/admin/query.md b/docs/reference/admin/query.md index c37a6b9f7..5fd1c1645 100644 --- a/docs/reference/admin/query.md +++ b/docs/reference/admin/query.md @@ -106,9 +106,7 @@ ## `!admin query resolver` ### `!admin query resolver cache` -Query the destinations or overrides cache - -Shows entire cache by default, but can be narrowed to only show overrides with `-o/--overrides true`, or to exclude them with `false` +Query the destinations or overrides cache, depending on the value of the `overrides` flag (default false) ### `!admin query resolver flush-cache` diff --git a/src/admin/appservice/commands.rs b/src/admin/appservice/commands.rs index 6afd9f468..9bccc643d 100644 --- a/src/admin/appservice/commands.rs +++ b/src/admin/appservice/commands.rs @@ -73,4 +73,29 @@ pub(super) async fn list_registered(&self) -> Result { }) .await } + + pub(super) async fn ensure_puppets_active(&self) -> Result { + self.services + .users + .stream_local_users() + .filter_map(async |user_id| { + if self.services.appservice.is_user_id(&user_id).await { + Some(user_id) + } else { + None + } + }) + .for_each(async |user_id| { + self.services + .users + .convert_to_shadow_account(&user_id) + .await + .expect("should be able to convert to shadow"); + }) + .await; + + write!(self, "All appservice puppets have been marked as active.").await?; + + Ok(()) + } } diff --git a/src/admin/appservice/mod.rs b/src/admin/appservice/mod.rs index 905e42c80..1e69a67a8 100644 --- a/src/admin/appservice/mod.rs +++ b/src/admin/appservice/mod.rs @@ -37,4 +37,10 @@ pub enum AppserviceCommand { /// List all the currently registered appservices #[clap(alias("list"))] ListRegistered, + + /// Ensure no appservice puppets are marked as deactivated. + /// This is a debug command to fix issues caused by a faulty database + /// migration in Continuwuity 26.6.0. + #[clap(hide = true)] + EnsurePuppetsActive, } diff --git a/src/web/pages/oidc/complete.rs b/src/web/pages/oidc/complete.rs index 62314e48f..bcffd13c8 100644 --- a/src/web/pages/oidc/complete.rs +++ b/src/web/pages/oidc/complete.rs @@ -107,7 +107,7 @@ async fn route_complete( let supplied_user_id = if let Some(form) = form { if let Ok(user_id) = UserId::parse(format!( "@{}:{}", - &form.username, + form.username, services.globals.server_name() )) && services.users.status(&user_id).await.is_active() {