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:
commit
731467315d
@ -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()
|
||||
|
@ -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
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -12,7 +12,8 @@ describe('Preferences/Notification', () => {
|
||||
follow: true,
|
||||
follow_request: true,
|
||||
reaction: true,
|
||||
status: true
|
||||
status: true,
|
||||
poll: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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": {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ const notify: Notify = {
|
||||
follow: true,
|
||||
follow_request: true,
|
||||
reaction: true,
|
||||
status: true
|
||||
status: true,
|
||||
poll: true
|
||||
}
|
||||
|
||||
const language: LanguageSet = {
|
||||
|
@ -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() {
|
||||
|
@ -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,
|
||||
|
@ -19,7 +19,8 @@ const state: NotificationState = {
|
||||
follow: true,
|
||||
follow_request: true,
|
||||
reaction: true,
|
||||
status: true
|
||||
status: true,
|
||||
poll: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,5 @@ export type Notify = {
|
||||
follow_request: boolean
|
||||
reaction: boolean
|
||||
status: boolean
|
||||
poll: boolean
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user