From 136e9db4b6c190824a0b05d01956ff924ef7aca9 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Tue, 2 Mar 2021 11:28:03 +0900 Subject: [PATCH] refs #2088 Add notification preference for status notification --- .../store/Preferences/Notification.spec.ts | 12 ++++++++---- .../unit/store/Preferences/Notification.spec.ts | 13 ++++++++++--- src/config/locales/en/translation.json | 4 +++- src/main/preferences.ts | 3 ++- .../components/Preferences/Notification.vue | 13 +++++++++++++ src/renderer/store/App.ts | 3 ++- src/renderer/store/Preferences/Notification.ts | 3 ++- src/types/notify.ts | 1 + 8 files changed, 41 insertions(+), 11 deletions(-) diff --git a/spec/renderer/integration/store/Preferences/Notification.spec.ts b/spec/renderer/integration/store/Preferences/Notification.spec.ts index fabf6442..d2498908 100644 --- a/spec/renderer/integration/store/Preferences/Notification.spec.ts +++ b/spec/renderer/integration/store/Preferences/Notification.spec.ts @@ -14,7 +14,8 @@ const state = (): NotificationState => { favourite: true, follow: true, follow_request: true, - reaction: true + reaction: true, + status: true } } } @@ -62,7 +63,8 @@ describe('Preferences/Notification', () => { favourite: false, follow: false, follow_request: false, - reaction: false + reaction: false, + status: false } } } @@ -79,7 +81,8 @@ describe('Preferences/Notification', () => { favourite: false, follow: false, follow_request: false, - reaction: false + reaction: false, + status: false } }) }) @@ -107,7 +110,8 @@ describe('Preferences/Notification', () => { favourite: true, follow: true, follow_request: true, - reaction: true + reaction: true, + status: 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 5a8c1540..2de80ede 100644 --- a/spec/renderer/unit/store/Preferences/Notification.spec.ts +++ b/spec/renderer/unit/store/Preferences/Notification.spec.ts @@ -11,7 +11,8 @@ describe('Preferences/Notification', () => { favourite: true, follow: true, follow_request: true, - reaction: true + reaction: true, + status: true } } } @@ -23,14 +24,20 @@ describe('Preferences/Notification', () => { reply: false, reblog: false, favourite: false, - follow: false + follow: false, + follow_request: false, + reaction: false, + status: false } }) expect(state.notification.notify).toEqual({ reply: false, reblog: false, favourite: false, - follow: false + follow: false, + follow_request: false, + reaction: false, + status: false }) }) }) diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index 70e53701..426b89a6 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -194,7 +194,9 @@ "reblog": "Notify me when I receive a reblog", "favourite": "Notify me when I receive a favourite", "follow": "Notify me when I receive a follow", - "reaction": "Notify me when I receive a emoji reaction" + "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" } }, "account": { diff --git a/src/main/preferences.ts b/src/main/preferences.ts index 49747f34..2a329338 100644 --- a/src/main/preferences.ts +++ b/src/main/preferences.ts @@ -48,7 +48,8 @@ const notify: Notify = { favourite: true, follow: true, follow_request: true, - reaction: true + reaction: true, + status: true } const language: LanguageSet = { diff --git a/src/renderer/components/Preferences/Notification.vue b/src/renderer/components/Preferences/Notification.vue index 9eff3ad0..aa950391 100644 --- a/src/renderer/components/Preferences/Notification.vue +++ b/src/renderer/components/Preferences/Notification.vue @@ -21,6 +21,9 @@ + + + @@ -88,6 +91,16 @@ export default { reaction: value }) } + }, + notifyStatus: { + get() { + return this.$store.state.Preferences.Notification.notification.notify.status + }, + set(value) { + this.$store.dispatch('Preferences/Notification/updateNotify', { + status: value + }) + } } }, created() { diff --git a/src/renderer/store/App.ts b/src/renderer/store/App.ts index a7187d37..306116af 100644 --- a/src/renderer/store/App.ts +++ b/src/renderer/store/App.ts @@ -39,7 +39,8 @@ const state = (): AppState => ({ favourite: true, follow: true, follow_request: true, - reaction: true + reaction: true, + status: true }, tootPadding: 8, timeFormat: TimeFormat.Absolute.value, diff --git a/src/renderer/store/Preferences/Notification.ts b/src/renderer/store/Preferences/Notification.ts index fec799bf..a5af21d2 100644 --- a/src/renderer/store/Preferences/Notification.ts +++ b/src/renderer/store/Preferences/Notification.ts @@ -18,7 +18,8 @@ const state: NotificationState = { favourite: true, follow: true, follow_request: true, - reaction: true + reaction: true, + status: true } } } diff --git a/src/types/notify.ts b/src/types/notify.ts index 4b8b89fe..36881f38 100644 --- a/src/types/notify.ts +++ b/src/types/notify.ts @@ -5,4 +5,5 @@ export type Notify = { follow: boolean follow_request: boolean reaction: boolean + status: boolean }