From f55207d5c7d90180a229b47fced8a7d78b9dcce4 Mon Sep 17 00:00:00 2001 From: Ginger Date: Fri, 10 Jul 2026 21:38:04 -0400 Subject: [PATCH] fix: Stop appservice users from being wrongly deactivated during migration --- changelog.d/+91e96207.bugfix.md | 1 + src/service/appservice/mod.rs | 9 +++++++++ src/service/migrations.rs | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelog.d/+91e96207.bugfix.md diff --git a/changelog.d/+91e96207.bugfix.md b/changelog.d/+91e96207.bugfix.md new file mode 100644 index 000000000..80be1138e --- /dev/null +++ b/changelog.d/+91e96207.bugfix.md @@ -0,0 +1 @@ +Stopped appservice users from being erroneously marked as deactivated during a 26.6 database migration. diff --git a/src/service/appservice/mod.rs b/src/service/appservice/mod.rs index 3c3efa9bc..94650bbef 100644 --- a/src/service/appservice/mod.rs +++ b/src/service/appservice/mod.rs @@ -224,6 +224,15 @@ pub async fn is_exclusive_user_id(&self, user_id: &UserId) -> bool { .any(|info| info.is_exclusive_user_match(user_id)) } + /// Checks if a given user id matches any appservice regex, exclusive or + /// otherwise + pub async fn is_user_id(&self, user_id: &UserId) -> bool { + self.read() + .await + .values() + .any(|info| info.is_user_match(user_id)) + } + /// Checks if a given room alias matches any exclusive appservice regex pub async fn is_exclusive_alias(&self, alias: &RoomAliasId) -> bool { self.read() diff --git a/src/service/migrations.rs b/src/service/migrations.rs index 8eb996a68..ac7813836 100644 --- a/src/service/migrations.rs +++ b/src/service/migrations.rs @@ -867,7 +867,7 @@ async fn split_userid_password(services: &Services) -> Result { userid_password.remove(&user_id); remote_users = remote_users.saturating_add(1); } else if hash.is_empty() { - if !(services.appservice.is_exclusive_user_id(&user_id).await + if !(services.appservice.is_user_id(&user_id).await || user_id == services.globals.server_user) { info!("Marking {user_id} as deactivated");