This commit is contained in:
syuilo
2020-09-18 22:18:21 +09:00
committed by GitHub
parent f104e9b6cc
commit df71dbb024
9 changed files with 36 additions and 17 deletions

View File

@ -328,8 +328,7 @@ export default Vue.extend({
},
async onNotification(notification) {
const t = this.$store.state.i.includingNotificationTypes;
if (!!t && !t.includes(notification.type)) {
if (this.$store.state.i.mutingNotificationTypes.includes(notification.type)) {
return;
}
if (document.visibilityState === 'visible') {

View File

@ -58,7 +58,7 @@ export default Vue.extend({
computed: {
allIncludeTypes() {
return this.includeTypes ?? this.$store.state.i.includingNotificationTypes;
return this.includeTypes ?? notificationTypes.filter(x => !this.$store.state.i.mutingNotificationTypes.includes(x));
}
},
@ -66,7 +66,7 @@ export default Vue.extend({
includeTypes() {
this.reload();
},
'$store.state.i.includingNotificationTypes'() {
'$store.state.i.mutingNotificationTypes'() {
if (this.includeTypes === null) {
this.reload();
}
@ -84,8 +84,7 @@ export default Vue.extend({
methods: {
onNotification(notification) {
//
const isMuted = !!this.allIncludeTypes && !this.allIncludeTypes.includes(notification.type);
const isMuted = !this.allIncludeTypes.includes(notification.type);
if (isMuted || document.visibilityState === 'visible') {
this.$root.stream.send('readNotification', {
id: notification.id

View File

@ -161,8 +161,7 @@ export default Vue.extend({
},
async onNotification(notification) {
const t = this.$store.state.i.includingNotificationTypes;
if (!!t && !t.includes(notification.type)) {
if (this.$store.state.i.mutingNotificationTypes.includes(notification.type)) {
return;
}

View File

@ -58,6 +58,7 @@ import XIntegration from './integration.vue';
import XApi from './api.vue';
import MkButton from '../../components/ui/button.vue';
import MkSwitch from '../../components/ui/switch.vue';
import { notificationTypes } from '../../../types';
export default Vue.extend({
metaInfo() {
@ -114,14 +115,15 @@ export default Vue.extend({
},
async configure() {
const includingTypes = notificationTypes.filter(x => !this.$store.state.i.mutingNotificationTypes.includes(x));
this.$root.new(await import('../../components/notification-setting-window.vue').then(m => m.default), {
includingTypes: this.$store.state.i.includingNotificationTypes,
includingTypes,
showGlobalToggle: false,
}).$on('ok', async ({ includingTypes: value }: any) => {
await this.$root.api('i/update', {
includingNotificationTypes: value,
mutingNotificationTypes: notificationTypes.filter(x => !value.includes(x)),
}).then(i => {
this.$store.state.i.includingNotificationTypes = i.includingNotificationTypes;
this.$store.state.i.mutingNotificationTypes = i.mutingNotificationTypes;
}).catch(err => {
this.$root.dialog({
type: 'error',