From 4409dc083b35d4e2213bdbf6c4ec7569997193e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Thu, 5 Oct 2023 16:25:08 +0200 Subject: [PATCH] Minor refactor to simplify the getStateFromNotifyProps (#24635) --- .../channel_notifications_modal.tsx | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.tsx b/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.tsx index c7b718c998..415fa40683 100644 --- a/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.tsx +++ b/webapp/channels/src/components/channel_notifications_modal/channel_notifications_modal.tsx @@ -105,11 +105,16 @@ const getDefaultPushNotifyLevel = (currentUserNotifyProps: UserNotifyProps, isGM return NotificationLevels.ALL; }; -const getDefaultPushThreadsNotifyLevel = (currentUserNotifyProps: UserNotifyProps): Exclude => { +const getDefaultPushThreadsNotifyLevel = (currentUserNotifyProps: UserNotifyProps, isGM: boolean): Exclude => { if (currentUserNotifyProps?.push_threads) { if (currentUserNotifyProps.push_threads === 'default') { return NotificationLevels.ALL; } + + if (isGM && currentUserNotifyProps.push_threads === NotificationLevels.MENTION) { + return NotificationLevels.ALL; + } + return currentUserNotifyProps.push_threads; } return NotificationLevels.ALL; @@ -119,7 +124,7 @@ export default class ChannelNotificationsModal extends React.PureComponent