From d1bca78083cc6a32842d10320a5bf84f81adae01 Mon Sep 17 00:00:00 2001 From: ClaireG Date: Wed, 16 Mar 2022 14:51:10 +0100 Subject: [PATCH] [Notification mode] Wrong mode is displayed when the mention only is selected on the web client --- changelog.d/5547.bugfix | 1 + .../RoomNotificationSettingsViewState.kt | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 changelog.d/5547.bugfix diff --git a/changelog.d/5547.bugfix b/changelog.d/5547.bugfix new file mode 100644 index 00000000000..3eb631902b4 --- /dev/null +++ b/changelog.d/5547.bugfix @@ -0,0 +1 @@ +[Notification mode] Wrong mode is displayed when the mention only is selected on the web client \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewState.kt b/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewState.kt index 832bb5036e6..d6d1176c36a 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewState.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/notifications/RoomNotificationSettingsViewState.kt @@ -40,14 +40,16 @@ data class RoomNotificationSettingsViewState( */ val RoomNotificationSettingsViewState.notificationStateMapped: Async get() { - if ((roomSummary()?.isEncrypted == true && notificationState() == RoomNotificationState.MENTIONS_ONLY) || - notificationState() == RoomNotificationState.ALL_MESSAGES) { - /** if in an encrypted room, mentions notifications are not supported so show "All Messages" as selected. + return when { + /** + * if in an encrypted room, mentions notifications are not supported so show "None" as selected. * Also in the new settings there is no notion of notifications without sound so it maps to noisy also */ - return Success(RoomNotificationState.ALL_MESSAGES_NOISY) + (roomSummary()?.isEncrypted == true && notificationState() == RoomNotificationState.MENTIONS_ONLY) + -> Success(RoomNotificationState.MUTE) + notificationState() == RoomNotificationState.ALL_MESSAGES -> Success(RoomNotificationState.ALL_MESSAGES_NOISY) + else -> notificationState } - return notificationState } /**