mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Add HS capability check
This commit is contained in:
+8
@@ -99,6 +99,14 @@ class DefaultSlashCommandService(
|
|||||||
override suspend fun proceedAdmin(
|
override suspend fun proceedAdmin(
|
||||||
slashCommand: SlashCommand.SlashCommandAdmin,
|
slashCommand: SlashCommand.SlashCommandAdmin,
|
||||||
): Result<Unit> {
|
): Result<Unit> {
|
||||||
|
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(
|
return commandExecutor.proceedAdmin(
|
||||||
slashCommand = slashCommand,
|
slashCommand = slashCommand,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user