1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-02-09 08:18:44 +01:00

Merge pull request #2263 from h3poteto/iss-2204

refs #2204 Create desktop notification when received poll notification
This commit is contained in:
AkiraFukushima 2021-03-21 21:47:01 +09:00 committed by GitHub
commit 731467315d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 57 additions and 10 deletions

View File

@ -15,7 +15,8 @@ const state = (): NotificationState => {
follow: true,
follow_request: true,
reaction: true,
status: true
status: true,
poll: true
}
}
}
@ -64,7 +65,8 @@ describe('Preferences/Notification', () => {
follow: false,
follow_request: false,
reaction: false,
status: false
status: false,
poll: false
}
}
}
@ -82,7 +84,8 @@ describe('Preferences/Notification', () => {
follow: false,
follow_request: false,
reaction: false,
status: false
status: false,
poll: false
}
})
})
@ -111,7 +114,8 @@ describe('Preferences/Notification', () => {
follow: true,
follow_request: true,
reaction: true,
status: true
status: true,
poll: true
}
})
expect(App.actions.loadPreferences).toBeCalled()

View File

@ -32,6 +32,20 @@ const initStore = () => {
}
}
const sideMenuStore = {
namespaced: true,
actions: {
listTags: jest.fn()
}
}
const timelineState = {
namespaced: true,
modules: {
SideMenu: sideMenuStore
}
}
describe('Hashtag/List', () => {
let store
let localVue
@ -41,7 +55,8 @@ describe('Hashtag/List', () => {
localVue.use(Vuex)
store = new Vuex.Store({
modules: {
List: initStore()
List: initStore(),
TimelineSpace: timelineState
}
})
})

View File

@ -12,7 +12,8 @@ describe('Preferences/Notification', () => {
follow: true,
follow_request: true,
reaction: true,
status: true
status: true,
poll: true
}
}
}

View File

@ -196,7 +196,8 @@
"follow": "Notify me when I receive a follow",
"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"
"status": "Notify me when I receive a status notification",
"poll": "Notify me when I receive a vote of poll"
}
},
"account": {

View File

@ -1439,6 +1439,15 @@ const createNotification = (notification: Entity.Notification, notifyConfig: Not
} as NotificationConstructorOptions
}
break
case NotificationType.Poll:
if (notifyConfig.poll) {
return {
title: i18next.t('notification.poll_vote.title'),
body: i18next.t('notification.poll_vote.body', { username: username(notification.account) }),
silent: false
} as NotificationConstructorOptions
}
break
default:
break
}

View File

@ -49,7 +49,8 @@ const notify: Notify = {
follow: true,
follow_request: true,
reaction: true,
status: true
status: true,
poll: true
}
const language: LanguageSet = {

View File

@ -24,6 +24,9 @@
<el-form-item for="notifyStatus" :label="$t('preferences.notification.enable.status')">
<el-switch v-model="notifyStatus" active-color="#13ce66"> </el-switch>
</el-form-item>
<el-form-item from="notifyPoll" :label="$t('preferences.notification.enable.poll')">
<el-switch v-model="notifyPoll" active-color="#13ce66"> </el-switch>
</el-form-item>
</el-form>
</div>
</template>
@ -101,6 +104,16 @@ export default {
status: value
})
}
},
notifyPoll: {
get() {
return this.$store.state.Preferences.Notification.notification.notify.poll
},
set(value) {
this.$store.dispatch('Preferences/Notification/updateNotify', {
poll: value
})
}
}
},
created() {

View File

@ -40,7 +40,8 @@ const state = (): AppState => ({
follow: true,
follow_request: true,
reaction: true,
status: true
status: true,
poll: true
},
tootPadding: 8,
timeFormat: TimeFormat.Absolute.value,

View File

@ -19,7 +19,8 @@ const state: NotificationState = {
follow: true,
follow_request: true,
reaction: true,
status: true
status: true,
poll: true
}
}
}

View File

@ -6,4 +6,5 @@ export type Notify = {
follow_request: boolean
reaction: boolean
status: boolean
poll: boolean
}