diff --git a/crates/handlers/src/graphql/mutations/user.rs b/crates/handlers/src/graphql/mutations/user.rs index 80be76b24..26352db81 100644 --- a/crates/handlers/src/graphql/mutations/user.rs +++ b/crates/handlers/src/graphql/mutations/user.rs @@ -144,9 +144,6 @@ impl LockUserPayload { struct UnlockUserInput { /// The ID of the user to unlock user_id: ID, - - /// Reactivate the user if it had been deactivated - reactivate: Option, } /// The status of the `unlockUser` mutation. @@ -566,7 +563,7 @@ impl UserMutations { Ok(LockUserPayload::Locked(user)) } - /// Unlock a user. This is only available to administrators. + /// Unlock and reactivate a user. This is only available to administrators. async fn unlock_user( &self, ctx: &Context<'_>, @@ -588,18 +585,12 @@ impl UserMutations { return Ok(UnlockUserPayload::NotFound); }; - let user = if input.reactivate.unwrap_or(false) { - // Call the homeserver synchronously to reactivate the user - let mxid = matrix.mxid(&user.username); - matrix.reactivate_user(&mxid).await?; + // Call the homeserver synchronously to reactivate the user + let mxid = matrix.mxid(&user.username); + matrix.reactivate_user(&mxid).await?; - // Now reactivate the user in our database - repo.user().reactivate(user).await? - } else { - user - }; - - // Now unlock the user in our database + // Now reactivate & unlock the user in our database + let user = repo.user().reactivate(user).await?; let user = repo.user().unlock(user).await?; repo.save().await?; diff --git a/frontend/schema.graphql b/frontend/schema.graphql index 993a554a3..99da32010 100644 --- a/frontend/schema.graphql +++ b/frontend/schema.graphql @@ -886,7 +886,7 @@ type Mutation { """ lockUser(input: LockUserInput!): LockUserPayload! """ - Unlock a user. This is only available to administrators. + Unlock and reactivate a user. This is only available to administrators. """ unlockUser(input: UnlockUserInput!): UnlockUserPayload! """ @@ -1842,10 +1842,6 @@ input UnlockUserInput { The ID of the user to unlock """ userId: ID! - """ - Reactivate the user if it had been deactivated - """ - reactivate: Boolean } """ diff --git a/frontend/src/gql/graphql.ts b/frontend/src/gql/graphql.ts index b07b89cf5..b6f357170 100644 --- a/frontend/src/gql/graphql.ts +++ b/frontend/src/gql/graphql.ts @@ -604,7 +604,7 @@ export type Mutation = { setPrimaryEmail: SetPrimaryEmailPayload; /** Start a new email authentication flow */ startEmailAuthentication: StartEmailAuthenticationPayload; - /** Unlock a user. This is only available to administrators. */ + /** Unlock and reactivate a user. This is only available to administrators. */ unlockUser: UnlockUserPayload; }; @@ -1347,8 +1347,6 @@ export type StartEmailAuthenticationStatus = /** The input for the `unlockUser` mutation. */ export type UnlockUserInput = { - /** Reactivate the user if it had been deactivated */ - reactivate?: InputMaybe; /** The ID of the user to unlock */ userId: Scalars['ID']['input']; };