1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-02 16:58:43 +09:00

通知の管理を強化

Resolve #3772
This commit is contained in:
syuilo 2018-12-28 05:06:25 +09:00
parent 8c762e7b8e
commit cce3e52642
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
6 changed files with 101 additions and 25 deletions

View File

@ -445,6 +445,14 @@ common/views/components/stream-indicator.vue:
reconnecting: "再接続中"
connected: "接続完了"
common/views/components/notification-settings.vue:
title: "通知"
mark-as-read-all-notifications: "すべての通知を既読にする"
mark-as-read-all-unread-notes: "すべての投稿を既読にする"
mark-as-read-all-talk-messages: "すべてのトークを既読にする"
auto-watch: "投稿の自動ウォッチ"
auto-watch-desc: "リアクションしたり返信したりした投稿に関する通知を自動的に受け取るようにします。"
common/views/components/integration-settings.vue:
title: "サービス連携"
connect: "接続する"
@ -842,7 +850,6 @@ desktop/views/components/settings.vue:
2fa: "二段階認証"
other: "その他"
license: "ライセンス"
mark-as-read-all-unread-notes: "すべての投稿を既読にする"
theme: "テーマ"
behaviour: "動作"
@ -904,9 +911,6 @@ desktop/views/components/settings.vue:
cache-cleared: "キャッシュを削除しました"
cache-cleared-desc: "ページを再度読み込みしてください。"
auto-watch: "投稿の自動ウォッチ"
auto-watch-desc: "リアクションしたり返信したりした投稿に関する通知を自動的に受け取るようにします。"
about: "Misskeyについて"
operator: "このサーバーの運営者"

View File

@ -0,0 +1,44 @@
<template>
<ui-card>
<div slot="title"><fa :icon="['far', 'bell']"/> {{ $t('notification') }}</div>
<section>
<ui-switch v-model="$store.state.i.settings.autoWatch" @change="onChangeAutoWatch">
{{ $t('auto-watch') }}<span slot="desc">{{ $t('auto-watch-desc') }}</span>
</ui-switch>
<section>
<ui-button @click="readAllNotifications">{{ $t('mark-as-read-all-notifications') }}</ui-button>
<ui-button @click="readAllUnreadNotes">{{ $t('mark-as-read-all-unread-notes') }}</ui-button>
<ui-button @click="readAllMessagingMessages">{{ $t('mark-as-read-all-talk-messages') }}</ui-button>
</section>
</section>
</ui-card>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
export default Vue.extend({
i18n: i18n('common/views/components/notification-settings.vue'),
methods: {
onChangeAutoWatch(v) {
this.$root.api('i/update', {
autoWatch: v
});
},
readAllUnreadNotes() {
this.$root.api('i/read_all_unread_notes');
},
readAllMessagingMessages() {
this.$root.api('i/read_all_messaging_messages');
},
readAllNotifications() {
this.$root.api('notifications/mark_all_as_read');
}
}
});
</script>

View File

@ -170,17 +170,7 @@
</section>
</ui-card>
<ui-card class="notification" v-show="page == 'notification'">
<div slot="title"><fa :icon="['far', 'bell']"/> {{ $t('notification') }}</div>
<section>
<ui-switch v-model="$store.state.i.settings.autoWatch" @change="onChangeAutoWatch">
{{ $t('auto-watch') }}<span slot="desc">{{ $t('auto-watch-desc') }}</span>
</ui-switch>
<section>
<ui-button @click="readAllUnreadNotes">{{ $t('mark-as-read-all-unread-notes') }}</ui-button>
</section>
</section>
</ui-card>
<x-notification-settings v-show="page == 'notification'"/>
<div class="drive" v-if="page == 'drive'">
<x-drive-settings/>
@ -289,6 +279,7 @@ import XPasswordSettings from '../../../common/views/components/password-setting
import XProfileEditor from '../../../common/views/components/profile-editor.vue';
import XApiSettings from '../../../common/views/components/api-settings.vue';
import XLanguageSettings from '../../../common/views/components/language-settings.vue';
import XNotificationSettings from '../../../common/views/components/notification-settings.vue';
import { url, clientVersion as version } from '../../../config';
import checkForUpdate from '../../../common/scripts/check-for-update';
@ -308,6 +299,7 @@ export default Vue.extend({
XProfileEditor,
XApiSettings,
XLanguageSettings,
XNotificationSettings,
},
props: {
initialPage: {
@ -531,9 +523,6 @@ export default Vue.extend({
});
},
methods: {
readAllUnreadNotes() {
this.$root.api('i/read_all_unread_notes');
},
customizeHome() {
this.$router.push('/i/customize-home');
this.$emit('done');
@ -552,11 +541,6 @@ export default Vue.extend({
wallpaperId: null
});
},
onChangeAutoWatch(v) {
this.$root.api('i/update', {
autoWatch: v
});
},
checkForUpdate() {
this.checkingForUpdate = true;
checkForUpdate(this.$root, true, true).then(newer => {

View File

@ -41,8 +41,6 @@ export default Vue.extend({
</script>
<style lang="stylus" scoped>
main
width 100%
max-width 680px

View File

@ -94,6 +94,8 @@
</section>
</ui-card>
<x-notification-settings/>
<x-drive-settings/>
<x-mute-and-block/>
@ -157,6 +159,7 @@ import XProfileEditor from '../../../common/views/components/profile-editor.vue'
import XApiSettings from '../../../common/views/components/api-settings.vue';
import XLanguageSettings from '../../../common/views/components/language-settings.vue';
import XIntegrationSettings from '../../../common/views/components/integration-settings.vue';
import XNotificationSettings from '../../../common/views/components/notification-settings.vue';
export default Vue.extend({
i18n: i18n('mobile/views/pages/settings.vue'),
@ -170,6 +173,7 @@ export default Vue.extend({
XApiSettings,
XLanguageSettings,
XIntegrationSettings,
XNotificationSettings,
},
data() {

View File

@ -0,0 +1,42 @@
import User from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import Message from '../../../../models/messaging-message';
import define from '../../define';
export const meta = {
desc: {
'ja-JP': 'トークメッセージをすべて既読にします。',
'en-US': 'Mark all talk messages as read.'
},
requireCredential: true,
kind: 'account-write',
params: {
}
};
export default define(meta, (ps, user) => new Promise(async (res, rej) => {
// Update documents
await Message.update({
recipientId: user._id,
isRead: false
}, {
$set: {
isRead: true
}
}, {
multi: true
});
User.update({ _id: user._id }, {
$set: {
hasUnreadMessagingMessage: false
}
});
publishMainStream(user._id, 'readAllMessagingMessages');
res();
}));