From 9bb22c71c40907ab3cc039a6e6dfb71689eda93d Mon Sep 17 00:00:00 2001 From: Sol Fisher Romanoff Date: Mon, 27 Jun 2022 14:51:59 +0300 Subject: [PATCH] Make message hiding togglable --- .../settings_modal/tabs/notifications_tab.vue | 8 ++++++++ src/i18n/en.json | 1 + src/modules/config.js | 1 + src/services/notification_utils/notification_utils.js | 10 +++++++--- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue index dd3806ed..5b3a62a9 100644 --- a/src/components/settings_modal/tabs/notifications_tab.vue +++ b/src/components/settings_modal/tabs/notifications_tab.vue @@ -65,6 +65,14 @@ {{ $t('settings.enable_web_push_notifications') }} +
  • + + {{ $t('settings.notification_setting_hide_if_cw') }} + +
  • { if (!visibleTypes(store).includes(notification.type)) return if (notification.type === 'mention' && isMutedNotification(store, notification)) return - const notificationObject = prepareNotificationObject(notification, store.rootGetters.i18n) + const notificationObject = prepareNotificationObject(notification, store.rootGetters.i18n, store) showDesktopNotification(rootState, notificationObject) } @@ -74,7 +74,7 @@ export const filteredNotificationsFromStore = (store, types) => { export const unseenNotificationsFromStore = store => filter(filteredNotificationsFromStore(store), ({ seen }) => !seen) -export const prepareNotificationObject = (notification, i18n) => { +export const prepareNotificationObject = (notification, i18n, store) => { const notifObj = { tag: notification.id } @@ -110,7 +110,11 @@ export const prepareNotificationObject = (notification, i18n) => { notifObj.body = i18n.t('notifications.' + i18nString) } else if (isStatusNotification(notification.type)) { if (notification.status.summary) { - notifObj.body = notification.status.summary + if (store.getters.mergedConfig.webPushHideIfCW) { + notifObj.body = notification.status.summary + } else { + notifObj.body = `${notification.status.summary}:\n${notification.status.text}` + } } else { notifObj.body = notification.status.text }