diff --git a/spec/renderer/integration/store/Preferences/Notification.spec.ts b/spec/renderer/integration/store/Preferences/Notification.spec.ts index 591f2c60..8ac086ab 100644 --- a/spec/renderer/integration/store/Preferences/Notification.spec.ts +++ b/spec/renderer/integration/store/Preferences/Notification.spec.ts @@ -16,7 +16,8 @@ const state = (): NotificationState => { follow_request: true, reaction: true, status: true, - poll_vote: true + poll_vote: true, + poll_expired: true } } } @@ -66,7 +67,8 @@ describe('Preferences/Notification', () => { follow_request: false, reaction: false, status: false, - poll_vote: false + poll_vote: false, + poll_expired: false } } } @@ -85,7 +87,8 @@ describe('Preferences/Notification', () => { follow_request: false, reaction: false, status: false, - poll_vote: false + poll_vote: false, + poll_expired: false } }) }) @@ -115,7 +118,8 @@ describe('Preferences/Notification', () => { follow_request: true, reaction: true, status: true, - poll_vote: true + poll_vote: true, + poll_expired: true } }) expect(App.actions.loadPreferences).toBeCalled() diff --git a/spec/renderer/unit/store/Preferences/Notification.spec.ts b/spec/renderer/unit/store/Preferences/Notification.spec.ts index 801ad274..93c66704 100644 --- a/spec/renderer/unit/store/Preferences/Notification.spec.ts +++ b/spec/renderer/unit/store/Preferences/Notification.spec.ts @@ -13,7 +13,8 @@ describe('Preferences/Notification', () => { follow_request: true, reaction: true, status: true, - poll_vote: true + poll_vote: true, + poll_expired: true } } } @@ -29,7 +30,8 @@ describe('Preferences/Notification', () => { follow_request: false, reaction: false, status: false, - poll_vote: false + poll_vote: false, + poll_expired: false } }) expect(state.notification.notify).toEqual({ @@ -40,7 +42,8 @@ describe('Preferences/Notification', () => { follow_request: false, reaction: false, status: false, - poll_vote: false + poll_vote: false, + poll_expired: false }) }) }) diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index 613e82cd..fb4ec39f 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -197,7 +197,8 @@ "reaction": "Notify me when I receive a emoji reaction", "follow_request": "Notify me when I receive a follow request", "status": "Notify me when I receive a status notification", - "poll_vote": "Notify me when I receive a vote of poll" + "poll_vote": "Notify me when I receive a vote of poll", + "poll_expired": "Notify me when I receive a poll expired event" } }, "account": { diff --git a/src/main/index.ts b/src/main/index.ts index d4877819..ac3d67c7 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1448,6 +1448,15 @@ const createNotification = (notification: Entity.Notification, notifyConfig: Not } as NotificationConstructorOptions } break + case NotificationType.PollExpired: + if (notifyConfig.poll_expired) { + return { + title: i18next.t('notification.poll_expired.title'), + body: i18next.t('notification.poll_expired.body', { username: username(notification.account) }), + silent: false + } as NotificationConstructorOptions + } + break default: break } diff --git a/src/main/preferences.ts b/src/main/preferences.ts index 1db4f3cb..d10b4ba3 100644 --- a/src/main/preferences.ts +++ b/src/main/preferences.ts @@ -50,7 +50,8 @@ const notify: Notify = { follow_request: true, reaction: true, status: true, - poll_vote: true + poll_vote: true, + poll_expired: true } const language: LanguageSet = { diff --git a/src/renderer/components/Preferences/Notification.vue b/src/renderer/components/Preferences/Notification.vue index 779c75ca..bac9d771 100644 --- a/src/renderer/components/Preferences/Notification.vue +++ b/src/renderer/components/Preferences/Notification.vue @@ -24,9 +24,12 @@ - + + + + @@ -114,6 +117,16 @@ export default { poll_vote: value }) } + }, + notifyPollExpired: { + get() { + return this.$store.state.Preferences.Notification.notification.notify.poll_expired + }, + set(value) { + this.$store.dispatch('Preferences/Notification/updateNotify', { + poll_expired: value + }) + } } }, created() { diff --git a/src/renderer/components/organisms/Notification/Status.vue b/src/renderer/components/organisms/Notification/Status.vue index ec300c84..4e11d97c 100644 --- a/src/renderer/components/organisms/Notification/Status.vue +++ b/src/renderer/components/organisms/Notification/Status.vue @@ -86,6 +86,7 @@ export default { .notified-status { padding-top: 8px; + .action { padding: 0 0 0 16px; margin-right: 8px; diff --git a/src/renderer/store/App.ts b/src/renderer/store/App.ts index f11ded91..e631e8ec 100644 --- a/src/renderer/store/App.ts +++ b/src/renderer/store/App.ts @@ -41,7 +41,8 @@ const state = (): AppState => ({ follow_request: true, reaction: true, status: true, - poll_vote: true + poll_vote: true, + poll_expired: true }, tootPadding: 8, timeFormat: TimeFormat.Absolute.value, diff --git a/src/renderer/store/Preferences/Notification.ts b/src/renderer/store/Preferences/Notification.ts index 79c37e8e..5ff5d416 100644 --- a/src/renderer/store/Preferences/Notification.ts +++ b/src/renderer/store/Preferences/Notification.ts @@ -20,7 +20,8 @@ const state: NotificationState = { follow_request: true, reaction: true, status: true, - poll_vote: true + poll_vote: true, + poll_expired: true } } } diff --git a/src/types/notify.ts b/src/types/notify.ts index d76c7e52..5b21ab88 100644 --- a/src/types/notify.ts +++ b/src/types/notify.ts @@ -7,4 +7,5 @@ export type Notify = { reaction: boolean status: boolean poll_vote: boolean + poll_expired: boolean }