From 4c1a167e2b96d0b19fe4adc9cabc1a3476df9609 Mon Sep 17 00:00:00 2001 From: bxdxnn <267911624+bxdxnn@users.noreply.github.com> Date: Fri, 29 May 2026 18:18:12 +0000 Subject: [PATCH] Add HS capability check --- .../slashcommands/impl/DefaultSlashCommandService.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/slashcommands/impl/src/main/kotlin/io/element/android/libraries/slashcommands/impl/DefaultSlashCommandService.kt b/libraries/slashcommands/impl/src/main/kotlin/io/element/android/libraries/slashcommands/impl/DefaultSlashCommandService.kt index 6cd8688cad..8234116bb1 100644 --- a/libraries/slashcommands/impl/src/main/kotlin/io/element/android/libraries/slashcommands/impl/DefaultSlashCommandService.kt +++ b/libraries/slashcommands/impl/src/main/kotlin/io/element/android/libraries/slashcommands/impl/DefaultSlashCommandService.kt @@ -99,6 +99,14 @@ class DefaultSlashCommandService( override suspend fun proceedAdmin( slashCommand: SlashCommand.SlashCommandAdmin, ): Result { + if (slashCommand is SlashCommand.ChangeDisplayNameForRoom) { + val canUserChangeDisplayName = withTimeoutOrNull(5.seconds) { + capabilitiesProvider.canChangeDisplayName().getOrNull() + } ?: false + if (!canUserChangeDisplayName) { + return Result.failure(Exception("Changing display name is not allowed")) + } + } return commandExecutor.proceedAdmin( slashCommand = slashCommand, )