diff --git a/CHANGES.md b/CHANGES.md index 2c9387b456..df0ddb6e64 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,7 +7,7 @@ Features ✨: Improvements 🙌: - "Add Matrix app" menu is now always visible (#1495) - - Handle `/op` and `/deop` commands (#12) + - Handle `/op`, `/deop`, and `/nick` commands (#12) Bugfix 🐛: - Fix dark theme issue on login screen (#1097) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt index a0c7447569..a4ed9d3ee9 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailViewModel.kt @@ -539,8 +539,8 @@ class RoomDetailViewModel @AssistedInject constructor( popDraft() } is ParsedCommand.ChangeDisplayName -> { - // TODO - _viewEvents.post(RoomDetailViewEvents.SlashCommandNotImplemented) + handleChangeDisplayNameSlashCommand(slashCommandResult) + popDraft() } is ParsedCommand.DiscardSession -> { if (room.isEncrypted()) { @@ -685,6 +685,12 @@ class RoomDetailViewModel @AssistedInject constructor( } } + private fun handleChangeDisplayNameSlashCommand(changeDisplayName: ParsedCommand.ChangeDisplayName) { + launchSlashCommandFlow { + session.setDisplayName(session.myUserId, changeDisplayName.displayName, it) + } + } + private fun handleKickSlashCommand(kick: ParsedCommand.KickUser) { launchSlashCommandFlow { room.kick(kick.userId, kick.reason, it)