Fix defalut note visibility setting (#5881)

* Fix default note visibility setting

* refactor

* missing translation

* fix
This commit is contained in:
tamaina 2020-02-08 20:02:15 +09:00 committed by GitHub
parent b58dd8c704
commit b2859bcd2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 4 deletions

View file

@ -349,6 +349,7 @@ post: "投稿"
posted: "投稿しました" posted: "投稿しました"
autoReloadWhenDisconnected: "サーバー切断時に自動リロード" autoReloadWhenDisconnected: "サーバー切断時に自動リロード"
autoNoteWatch: "ノートの自動ウォッチ" autoNoteWatch: "ノートの自動ウォッチ"
autoNoteWatchDescription: "あなたがリアクションしたり返信したりした他のユーザーのノートに関する通知を受け取るようにします。"
reduceUiAnimation: "UIのアニメーションを減らす" reduceUiAnimation: "UIのアニメーションを減らす"
share: "共有" share: "共有"
notFound: "見つかりません" notFound: "見つかりません"
@ -475,6 +476,7 @@ _visibility:
followersDescription: "自分のフォロワーのみに公開" followersDescription: "自分のフォロワーのみに公開"
specified: "ダイレクト" specified: "ダイレクト"
specifiedDescription: "指定したユーザーのみに公開" specifiedDescription: "指定したユーザーのみに公開"
localOnly: "ローカルのみ"
_postForm: _postForm:
replyPlaceholder: "このノートに返信..." replyPlaceholder: "このノートに返信..."

View file

@ -217,7 +217,7 @@ export default Vue.extend({
// //
this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? this.$store.state.device.visibility : this.$store.state.settings.defaultNoteVisibility); this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? this.$store.state.device.visibility : this.$store.state.settings.defaultNoteVisibility);
this.localOnly = this.$store.state.settings.rememberNoteVisibility ? this.$store.state.device.localOnly : false; this.localOnly = this.$store.state.settings.rememberNoteVisibility ? this.$store.state.device.localOnly : this.$store.state.settings.defaultNoteLocalOnly;
// //
if (this.reply && ['home', 'followers', 'specified'].includes(this.reply.visibility)) { if (this.reply && ['home', 'followers', 'specified'].includes(this.reply.visibility)) {
@ -398,8 +398,7 @@ export default Vue.extend({
}, },
applyVisibility(v: string) { applyVisibility(v: string) {
if (!['public', 'home', 'followers', 'specified'].includes(v)) v = 'public'; // v11 this.visibility = ['public', 'home', 'followers', 'specified'].includes(v) ? v : 'public'; // v11
this.visibility = v;
}, },
addVisibleUser() { addVisibleUser() {

View file

@ -14,7 +14,7 @@
{{ $t('autoReloadWhenDisconnected') }} {{ $t('autoReloadWhenDisconnected') }}
</mk-switch> </mk-switch>
<mk-switch v-model="$store.state.i.autoWatch" @change="onChangeAutoWatch"> <mk-switch v-model="$store.state.i.autoWatch" @change="onChangeAutoWatch">
{{ $t('autoNoteWatch') }}<template #desc>{{ $t('auto-watch-desc') }}</template> {{ $t('autoNoteWatch') }}<template #desc>{{ $t('autoNoteWatchDescription') }}</template>
</mk-switch> </mk-switch>
</div> </div>
<div class="_content"> <div class="_content">

View file

@ -10,9 +10,11 @@
<mk-select v-model="defaultNoteVisibility" style="margin-bottom: 8px;" v-if="!rememberNoteVisibility"> <mk-select v-model="defaultNoteVisibility" style="margin-bottom: 8px;" v-if="!rememberNoteVisibility">
<template #label>{{ $t('defaultNoteVisibility') }}</template> <template #label>{{ $t('defaultNoteVisibility') }}</template>
<option value="public">{{ $t('_visibility.public') }}</option> <option value="public">{{ $t('_visibility.public') }}</option>
<option value="home">{{ $t('_visibility.home') }}</option>
<option value="followers">{{ $t('_visibility.followers') }}</option> <option value="followers">{{ $t('_visibility.followers') }}</option>
<option value="specified">{{ $t('_visibility.specified') }}</option> <option value="specified">{{ $t('_visibility.specified') }}</option>
</mk-select> </mk-select>
<mk-switch v-model="defaultNoteLocalOnly" v-if="!rememberNoteVisibility">{{ $t('_visibility.localOnly') }}</mk-switch>
</div> </div>
</section> </section>
</template> </template>
@ -46,6 +48,11 @@ export default Vue.extend({
set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteVisibility', value }); } set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteVisibility', value }); }
}, },
defaultNoteLocalOnly: {
get() { return this.$store.state.settings.defaultNoteLocalOnly; },
set(value) { this.$store.dispatch('settings/set', { key: 'defaultNoteLocalOnly', value }); }
},
rememberNoteVisibility: { rememberNoteVisibility: {
get() { return this.$store.state.settings.rememberNoteVisibility; }, get() { return this.$store.state.settings.rememberNoteVisibility; },
set(value) { this.$store.dispatch('settings/set', { key: 'rememberNoteVisibility', value }); } set(value) { this.$store.dispatch('settings/set', { key: 'rememberNoteVisibility', value }); }

View file

@ -9,6 +9,7 @@ const defaultSettings = {
showFullAcct: false, showFullAcct: false,
rememberNoteVisibility: false, rememberNoteVisibility: false,
defaultNoteVisibility: 'public', defaultNoteVisibility: 'public',
defaultNoteLocalOnly: false,
uploadFolder: null, uploadFolder: null,
pastedFileName: 'yyyy-MM-dd HH-mm-ss [{{number}}]', pastedFileName: 'yyyy-MM-dd HH-mm-ss [{{number}}]',
wallpaper: null, wallpaper: null,