forked from AkkomaGang/akkoma-fe
Respect subject lines in notifications (#23)
Reviewed-on: AkkomaGang/pleroma-fe#23 Co-authored-by: sfr <sol@solfisher.com> Co-committed-by: sfr <sol@solfisher.com>
This commit is contained in:
parent
06343addef
commit
716320de35
4 changed files with 21 additions and 3 deletions
|
@ -65,6 +65,14 @@
|
||||||
{{ $t('settings.enable_web_push_notifications') }}
|
{{ $t('settings.enable_web_push_notifications') }}
|
||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<BooleanSetting
|
||||||
|
path="webPushHideIfCW"
|
||||||
|
expert="1"
|
||||||
|
>
|
||||||
|
{{ $t('settings.notification_setting_hide_if_cw') }}
|
||||||
|
</BooleanSetting>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting
|
<BooleanSetting
|
||||||
path="serverSide_webPushHideContents"
|
path="serverSide_webPushHideContents"
|
||||||
|
|
|
@ -546,6 +546,7 @@
|
||||||
"notification_setting_block_from_strangers": "Block notifications from users who you do not follow",
|
"notification_setting_block_from_strangers": "Block notifications from users who you do not follow",
|
||||||
"notification_setting_privacy": "Privacy",
|
"notification_setting_privacy": "Privacy",
|
||||||
"notification_setting_hide_notification_contents": "Hide the sender and contents of push notifications",
|
"notification_setting_hide_notification_contents": "Hide the sender and contents of push notifications",
|
||||||
|
"notification_setting_hide_if_cw": "Hide the contents of push notifications if under a Content Warning",
|
||||||
"notification_mutes": "To stop receiving notifications from a specific user, use a mute.",
|
"notification_mutes": "To stop receiving notifications from a specific user, use a mute.",
|
||||||
"notification_blocks": "Blocking a user stops all notifications as well as unsubscribes them.",
|
"notification_blocks": "Blocking a user stops all notifications as well as unsubscribes them.",
|
||||||
"enable_web_push_notifications": "Enable web push notifications",
|
"enable_web_push_notifications": "Enable web push notifications",
|
||||||
|
|
|
@ -63,6 +63,7 @@ export const defaultState = {
|
||||||
polls: true
|
polls: true
|
||||||
},
|
},
|
||||||
webPushNotifications: false,
|
webPushNotifications: false,
|
||||||
|
webPushHideIfCW: true,
|
||||||
muteWords: [],
|
muteWords: [],
|
||||||
highlight: {},
|
highlight: {},
|
||||||
interfaceLanguage: browserLocale,
|
interfaceLanguage: browserLocale,
|
||||||
|
|
|
@ -58,7 +58,7 @@ export const maybeShowNotification = (store, notification) => {
|
||||||
if (!visibleTypes(store).includes(notification.type)) return
|
if (!visibleTypes(store).includes(notification.type)) return
|
||||||
if (notification.type === 'mention' && isMutedNotification(store, notification)) 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)
|
showDesktopNotification(rootState, notificationObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ export const filteredNotificationsFromStore = (store, types) => {
|
||||||
export const unseenNotificationsFromStore = store =>
|
export const unseenNotificationsFromStore = store =>
|
||||||
filter(filteredNotificationsFromStore(store), ({ seen }) => !seen)
|
filter(filteredNotificationsFromStore(store), ({ seen }) => !seen)
|
||||||
|
|
||||||
export const prepareNotificationObject = (notification, i18n) => {
|
export const prepareNotificationObject = (notification, i18n, store) => {
|
||||||
const notifObj = {
|
const notifObj = {
|
||||||
tag: notification.id
|
tag: notification.id
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,15 @@ export const prepareNotificationObject = (notification, i18n) => {
|
||||||
} else if (i18nString) {
|
} else if (i18nString) {
|
||||||
notifObj.body = i18n.t('notifications.' + i18nString)
|
notifObj.body = i18n.t('notifications.' + i18nString)
|
||||||
} else if (isStatusNotification(notification.type)) {
|
} else if (isStatusNotification(notification.type)) {
|
||||||
notifObj.body = notification.status.text
|
if (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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shows first attached non-nsfw image, if any. Should add configuration for this somehow...
|
// Shows first attached non-nsfw image, if any. Should add configuration for this somehow...
|
||||||
|
|
Loading…
Reference in a new issue