mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 13:16:56 +00:00
fix: Add admin command to ensure all appservice puppets are active
This commit is contained in:
1 parent
f55207d5c7
commit
0b1e24a9ad
6 files changed
+41
-4
No files matched your search
@@ -27,3 +27,7 @@ You can find the ID using the `list-appservices` command.
|
|||||||
## `!admin appservices list-registered`
|
## `!admin appservices list-registered`
|
||||||
|
|
||||||
List all the currently registered appservices
|
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
|
||||||
@@ -146,6 +146,10 @@ List database files
|
|||||||
|
|
||||||
Send a test email to the invoking admin's email address
|
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`
|
## `!admin debug tester`
|
||||||
|
|
||||||
Developer test stubs
|
Developer test stubs
|
||||||
@@ -106,9 +106,7 @@ resolver service
|
|||||||
|
|
||||||
### `!admin query resolver cache`
|
### `!admin query resolver cache`
|
||||||
|
|
||||||
Query the destinations or overrides cache
|
Query the destinations or overrides cache, depending on the value of the `overrides` flag (default false)
|
||||||
|
|
||||||
Shows entire cache by default, but can be narrowed to only show overrides with `-o/--overrides true`, or to exclude them with `false`
|
|
||||||
|
|
||||||
### `!admin query resolver flush-cache`
|
### `!admin query resolver flush-cache`
|
||||||
|
|
||||||
|
|||||||
@@ -73,4 +73,29 @@ impl crate::Context<'_> {
|
|||||||
})
|
})
|
||||||
.await
|
.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(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -37,4 +37,10 @@ pub enum AppserviceCommand {
|
|||||||
/// List all the currently registered appservices
|
/// List all the currently registered appservices
|
||||||
#[clap(alias("list"))]
|
#[clap(alias("list"))]
|
||||||
ListRegistered,
|
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,
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ async fn route_complete(
|
|||||||
let supplied_user_id = if let Some(form) = form {
|
let supplied_user_id = if let Some(form) = form {
|
||||||
if let Ok(user_id) = UserId::parse(format!(
|
if let Ok(user_id) = UserId::parse(format!(
|
||||||
"@{}:{}",
|
"@{}:{}",
|
||||||
&form.username,
|
form.username,
|
||||||
services.globals.server_name()
|
services.globals.server_name()
|
||||||
)) && services.users.status(&user_id).await.is_active()
|
)) && services.users.status(&user_id).await.is_active()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user