From df487e3980f7128fa366ea25e99bed17af114d52 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu <tusooa@kazv.moe> Date: Fri, 20 May 2022 12:39:46 -0400 Subject: [PATCH 1/4] Show poll-end notifications Ref: poll-notif --- src/components/notification/notification.vue | 8 ++++++++ src/services/notification_utils/notification_utils.js | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 9ecb034f..7d3d0c69 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -120,6 +120,14 @@ </i18n-t> </small> </span> + <span v-if="notification.type === 'poll'"> + <FAIcon + class="type-icon" + icon="poll-h" + /> + {{ ' ' }} + <small>{{ $t('notifications.poll_ended') }}</small> + </span> </div> <div v-if="isStatusNotification" diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index 6fef1022..8a05f77b 100644 --- a/src/services/notification_utils/notification_utils.js +++ b/src/services/notification_utils/notification_utils.js @@ -14,11 +14,12 @@ export const visibleTypes = store => { rootState.config.notificationVisibility.follows && 'follow', rootState.config.notificationVisibility.followRequest && 'follow_request', rootState.config.notificationVisibility.moves && 'move', - rootState.config.notificationVisibility.emojiReactions && 'pleroma:emoji_reaction' + rootState.config.notificationVisibility.emojiReactions && 'pleroma:emoji_reaction', + 'poll' ].filter(_ => _)) } -const statusNotifications = ['like', 'mention', 'repeat', 'pleroma:emoji_reaction'] +const statusNotifications = ['like', 'mention', 'repeat', 'pleroma:emoji_reaction', 'poll'] export const isStatusNotification = (type) => includes(statusNotifications, type) @@ -98,6 +99,9 @@ export const prepareNotificationObject = (notification, i18n) => { case 'follow_request': i18nString = 'follow_request' break + case 'poll': + i18nString = 'poll_ended' + break } if (notification.type === 'pleroma:emoji_reaction') { From a4b6a97b1b96a15d5a74ae59e36eba7649ac8515 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu <tusooa@kazv.moe> Date: Fri, 20 May 2022 16:35:07 -0400 Subject: [PATCH 2/4] Add English translations for poll-end notifications Ref: poll-notif --- src/i18n/en.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/i18n/en.json b/src/i18n/en.json index f8336e5c..699917fe 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -160,7 +160,8 @@ "repeated_you": "repeated your status", "no_more_notifications": "No more notifications", "migrated_to": "migrated to", - "reacted_with": "reacted with {0}" + "reacted_with": "reacted with {0}", + "poll_ended": "poll has ended" }, "polls": { "add_poll": "Add poll", From a35daceb5ba96ba0f843ee405617fc043cd68f61 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu <tusooa@kazv.moe> Date: Fri, 20 May 2022 16:41:45 -0400 Subject: [PATCH 3/4] Add settings for filtering end-of-poll notifications Ref: poll-notif --- src/components/notifications/notification_filters.vue | 9 +++++++++ src/components/settings_modal/tabs/notifications_tab.vue | 5 +++++ src/modules/config.js | 3 ++- src/services/notification_utils/notification_utils.js | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/notifications/notification_filters.vue b/src/components/notifications/notification_filters.vue index ba0e90a0..0fe6713f 100644 --- a/src/components/notifications/notification_filters.vue +++ b/src/components/notifications/notification_filters.vue @@ -61,6 +61,15 @@ :class="{ 'menu-checkbox-checked': filters.moves }" />{{ $t('settings.notification_visibility_moves') }} </button> + <button + class="button-default dropdown-item" + @click="toggleNotificationFilter('polls')" + > + <span + class="menu-checkbox" + :class="{ 'menu-checkbox-checked': filters.polls }" + />{{ $t('settings.notification_visibility_polls') }} + </button> </div> </template> <template v-slot:trigger> diff --git a/src/components/settings_modal/tabs/notifications_tab.vue b/src/components/settings_modal/tabs/notifications_tab.vue index 86be6095..dd3806ed 100644 --- a/src/components/settings_modal/tabs/notifications_tab.vue +++ b/src/components/settings_modal/tabs/notifications_tab.vue @@ -41,6 +41,11 @@ {{ $t('settings.notification_visibility_emoji_reactions') }} </BooleanSetting> </li> + <li> + <BooleanSetting path="notificationVisibility.polls"> + {{ $t('settings.notification_visibility_polls') }} + </BooleanSetting> + </li> </ul> </li> </ul> diff --git a/src/modules/config.js b/src/modules/config.js index ff5ef270..13f1045b 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -54,7 +54,8 @@ export const defaultState = { moves: true, emojiReactions: true, followRequest: true, - chatMention: true + chatMention: true, + polls: true }, webPushNotifications: false, muteWords: [], diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index 8a05f77b..a221b022 100644 --- a/src/services/notification_utils/notification_utils.js +++ b/src/services/notification_utils/notification_utils.js @@ -15,7 +15,7 @@ export const visibleTypes = store => { rootState.config.notificationVisibility.followRequest && 'follow_request', rootState.config.notificationVisibility.moves && 'move', rootState.config.notificationVisibility.emojiReactions && 'pleroma:emoji_reaction', - 'poll' + rootState.config.notificationVisibility.polls && 'poll' ].filter(_ => _)) } From 6e0ceda968625259bafea72cf90446b610f0b913 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu <tusooa@kazv.moe> Date: Fri, 20 May 2022 16:42:18 -0400 Subject: [PATCH 4/4] Add English translation for filtering end-of-poll notifications Ref: poll-notif --- src/i18n/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i18n/en.json b/src/i18n/en.json index 699917fe..733df0a0 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -428,6 +428,7 @@ "notification_visibility_repeats": "Repeats", "notification_visibility_moves": "User Migrates", "notification_visibility_emoji_reactions": "Reactions", + "notification_visibility_polls": "Ends of polls you voted in", "no_rich_text_description": "Strip rich text formatting from all posts", "no_blocks": "No blocks", "no_mutes": "No mutes",