fix: Add admin command to ensure all appservice puppets are active

This commit is contained in:
Ginger
2026-07-11 14:55:43 +00:00
committed by Ellis Git
parent f55207d5c7
commit 0b1e24a9ad
6 changed files with 41 additions and 4 deletions
+4
View File
@@ -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
+4
View File
@@ -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
+1 -3
View File
@@ -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`
+25
View File
@@ -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(())
}
}
+6
View File
@@ -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,
}
+1 -1
View File
@@ -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()
{