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

View File

@ -179,7 +179,8 @@
"reply": "Notify me when I receive a reply", "reply": "Notify me when I receive a reply",
"reblog": "Notify me when I receive a reblog", "reblog": "Notify me when I receive a reblog",
"favourite": "Notify me when I receive a favourite", "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": { "account": {

View File

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