refs #1281 Add reaction notification preferences

This commit is contained in:
AkiraFukushima 2020-04-25 21:38:23 +09:00
parent aacb1437cb
commit b6ae363db4
3 changed files with 53 additions and 52 deletions

View File

@ -59,7 +59,8 @@ describe('Preferences/Notification', () => {
reply: false,
reblog: false,
favourite: false,
follow: false
follow: false,
reaction: false
}
}
})
@ -71,7 +72,8 @@ describe('Preferences/Notification', () => {
reply: false,
reblog: false,
favourite: false,
follow: false
follow: false,
reaction: false
}
})
})
@ -94,7 +96,8 @@ describe('Preferences/Notification', () => {
reply: false,
reblog: false,
favourite: true,
follow: true
follow: true,
reaction: true
}
})
expect(App.actions.loadPreferences).toBeCalled()

View File

@ -179,7 +179,8 @@
"reply": "Notify me when I receive a reply",
"reblog": "Notify me when I receive a reblog",
"favourite": "Notify me when I receive a favourite",
"follow": "Notify me when I receive a follow"
"follow": "Notify me when I receive a follow",
"reaction": "Notify me when I receive a emoji reaction"
}
},
"account": {

View File

@ -1,37 +1,25 @@
<template>
<div id="notification">
<h2>{{ $t('preferences.notification.title') }}</h2>
<el-form class="section" label-position="right" label-width="250px" size="small">
<p class="description">{{ $t('preferences.notification.enable.description') }}</p>
<el-form-item for="notifyReply" :label="$t('preferences.notification.enable.reply')">
<el-switch
id="notifyReply"
v-model="notifyReply"
active-color="#13ce66">
</el-switch>
</el-form-item>
<el-form-item for="notifyReblog" :label="$t('preferences.notification.enable.reblog')">
<el-switch
id="notifyReblog"
v-model="notifyReblog"
active-color="#13ce66">
</el-switch>
</el-form-item>
<el-form-item for="notifyFavourite" :label="$t('preferences.notification.enable.favourite')">
<el-switch
id="notifyFavourite"
v-model="notifyFavourite"
active-color="#13ce66">
</el-switch>
</el-form-item>
<el-form-item for="notifyFollow" :label="$t('preferences.notification.enable.follow')">
<el-switch
v-model="notifyFollow"
active-color="#13ce66">
</el-switch>
</el-form-item>
</el-form>
</div>
<div id="notification">
<h2>{{ $t('preferences.notification.title') }}</h2>
<el-form class="section" label-position="right" label-width="300px" size="small">
<p class="description">{{ $t('preferences.notification.enable.description') }}</p>
<el-form-item for="notifyReply" :label="$t('preferences.notification.enable.reply')">
<el-switch id="notifyReply" v-model="notifyReply" active-color="#13ce66"> </el-switch>
</el-form-item>
<el-form-item for="notifyReblog" :label="$t('preferences.notification.enable.reblog')">
<el-switch id="notifyReblog" v-model="notifyReblog" active-color="#13ce66"> </el-switch>
</el-form-item>
<el-form-item for="notifyReaction" :label="$t('preferences.notification.enable.reaction')">
<el-switch id="notifyReaction" v-model="notifyReaction" active-color="#13ce66"> </el-switch>
</el-form-item>
<el-form-item for="notifyFavourite" :label="$t('preferences.notification.enable.favourite')">
<el-switch id="notifyFavourite" v-model="notifyFavourite" active-color="#13ce66"> </el-switch>
</el-form-item>
<el-form-item for="notifyFollow" :label="$t('preferences.notification.enable.follow')">
<el-switch v-model="notifyFollow" active-color="#13ce66"> </el-switch>
</el-form-item>
</el-form>
</div>
</template>
<script>
@ -39,54 +27,63 @@ export default {
name: 'notification',
computed: {
notifyReply: {
get () {
get() {
return this.$store.state.Preferences.Notification.notification.notify.reply
},
set (value) {
set(value) {
this.$store.dispatch('Preferences/Notification/updateNotify', {
reply: value
})
}
},
notifyReblog: {
get () {
get() {
return this.$store.state.Preferences.Notification.notification.notify.reblog
},
set (value) {
set(value) {
this.$store.dispatch('Preferences/Notification/updateNotify', {
reblog: value
})
}
},
notifyFavourite: {
get () {
get() {
return this.$store.state.Preferences.Notification.notification.notify.favourite
},
set (value) {
set(value) {
this.$store.dispatch('Preferences/Notification/updateNotify', {
favourite: value
})
}
},
notifyFollow: {
get () {
get() {
return this.$store.state.Preferences.Notification.notification.notify.follow
},
set (value) {
set(value) {
this.$store.dispatch('Preferences/Notification/updateNotify', {
follow: value
})
}
},
notifyReaction: {
get() {
return this.$store.state.Preferences.Notification.notification.notify.reaction
},
set(value) {
this.$store.dispatch('Preferences/Notification/updateNotify', {
reaction: value
})
}
}
},
created () {
this.$store.dispatch('Preferences/Notification/loadNotification')
.catch(() => {
this.$message({
message: this.$t('message.preferences_load_error'),
type: 'error'
})
created() {
this.$store.dispatch('Preferences/Notification/loadNotification').catch(() => {
this.$message({
message: this.$t('message.preferences_load_error'),
type: 'error'
})
})
}
}
</script>