refs #2204 Create desktop notification when received poll notification

This commit is contained in:
AkiraFukushima 2021-03-21 21:27:47 +09:00
parent eaecb8ad4e
commit 70b877f9f0
9 changed files with 35 additions and 6 deletions

View File

@ -15,7 +15,8 @@ const state = (): NotificationState => {
follow: true,
follow_request: true,
reaction: true,
status: true
status: true,
poll: true
}
}
}

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
}