From efaaa76185ec7ee39e855d90bdcdb8a4d13f0207 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 7 Sep 2018 21:13:15 +0900 Subject: [PATCH] Improve note visibility settings Closes #2312 Closes #2313 --- locales/ja-JP.yml | 16 +++++++++++ .../views/components/visibility-chooser.vue | 6 +++-- .../desktop/views/components/post-form.vue | 2 +- .../app/desktop/views/components/settings.vue | 27 +++++++++++++++++++ .../app/mobile/views/components/post-form.vue | 2 +- .../app/mobile/views/pages/settings.vue | 27 +++++++++++++++++++ src/client/app/store.ts | 2 ++ 7 files changed, 78 insertions(+), 4 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 3cf8d90e9..07d8e7f48 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -73,6 +73,16 @@ common: rip: "RIP" pudding: "Pudding" + note-visibility: + public: "公開" + home: "ホーム" + home-desc: "ホームタイムラインにのみ公開" + followers: "フォロワー" + followers-desc: "自分のフォロワーにのみ公開" + specified: "ダイレクト" + specified-desc: "指定したユーザーにのみ公開" + private: "非公開" + note-placeholders: a: "今どうしてる?" b: "何かありましたか?" @@ -724,6 +734,9 @@ desktop/views/components/settings.vue: behaviour: "動作" fetch-on-scroll: "スクロールで自動読み込み" fetch-on-scroll-desc: "ページを下までスクロールしたときに自動で追加のコンテンツを読み込みます。" + note-visibility: "投稿の公開範囲" + default-note-visibility: "デフォルトの公開範囲" + remember-note-visibility: "投稿の公開範囲を記憶する" auto-popout: "ウィンドウの自動ポップアウト" auto-popout-desc: "ウィンドウが開かれるとき、ポップアウト(ブラウザ外に切り離す)可能なら自動でポップアウトします。この設定はブラウザに記憶されます。" advanced: "詳細設定" @@ -1365,6 +1378,9 @@ mobile/views/pages/settings.vue: notification-position-top: "上" behavior: "動作" fetch-on-scroll: "スクロールで自動読み込み" + note-visibility: "投稿の公開範囲" + default-note-visibility: "デフォルトの公開範囲" + remember-note-visibility: "投稿の公開範囲を記憶する" disable-via-mobile: "「モバイルからの投稿」フラグを付けない" load-raw-images: "添付された画像を高画質で表示する" load-remote-media: "リモートサーバーのメディアを表示する" diff --git a/src/client/app/common/views/components/visibility-chooser.vue b/src/client/app/common/views/components/visibility-chooser.vue index 4691604e5..7d90b3520 100644 --- a/src/client/app/common/views/components/visibility-chooser.vue +++ b/src/client/app/common/views/components/visibility-chooser.vue @@ -47,7 +47,7 @@ export default Vue.extend({ props: ['source', 'compact'], data() { return { - v: this.$store.state.device.visibility || 'public' + v: this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility } }, mounted() { @@ -97,7 +97,9 @@ export default Vue.extend({ }, methods: { choose(visibility) { - this.$store.commit('device/setVisibility', visibility); + if (this.$store.state.settings.rememberNoteVisibility) { + this.$store.commit('device/setVisibility', visibility); + } this.$emit('chosen', visibility); this.$destroy(); }, diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue index 65dc9eb9c..b2f0954d9 100644 --- a/src/client/app/desktop/views/components/post-form.vue +++ b/src/client/app/desktop/views/components/post-form.vue @@ -100,7 +100,7 @@ export default Vue.extend({ useCw: false, cw: null, geo: null, - visibility: this.$store.state.device.visibility || 'public', + visibility: this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility, visibleUsers: [], autocomplete: null, draghover: false, diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue index d800ccfe1..3998adf60 100644 --- a/src/client/app/desktop/views/components/settings.vue +++ b/src/client/app/desktop/views/components/settings.vue @@ -26,6 +26,22 @@ %i18n:@auto-popout-desc% + +
+
%i18n:@note-visibility%
+ +
+
%i18n:@default-note-visibility%
+ + + + + + + +
+
+
%i18n:@advanced% @@ -239,6 +255,11 @@ export default Vue.extend({ set(value) { this.$store.commit('device/set', { key: 'apiViaStream', value }); } }, + defaultNoteVisibility: { + get() { return this.$store.state.settings.defaultNoteVisibility; }, + set(value) { this.$store.commit('settings/set', { key: 'defaultNoteVisibility', value }); } + }, + autoPopout: { get() { return this.$store.state.device.autoPopout; }, set(value) { this.$store.commit('device/set', { key: 'autoPopout', value }); } @@ -312,6 +333,12 @@ export default Vue.extend({ value: v }); }, + onChangeRememberNoteVisibility(v) { + this.$store.dispatch('settings/set', { + key: 'rememberNoteVisibility', + value: v + }); + }, onChangeAutoWatch(v) { (this as any).api('i/update', { autoWatch: v diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue index 8107c1f3a..dcb2f16fa 100644 --- a/src/client/app/mobile/views/components/post-form.vue +++ b/src/client/app/mobile/views/components/post-form.vue @@ -95,7 +95,7 @@ export default Vue.extend({ files: [], poll: false, geo: null, - visibility: this.$store.state.device.visibility || 'public', + visibility: this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility, visibleUsers: [], useCw: false, cw: null, diff --git a/src/client/app/mobile/views/pages/settings.vue b/src/client/app/mobile/views/pages/settings.vue index 29fe067a0..a07892901 100644 --- a/src/client/app/mobile/views/pages/settings.vue +++ b/src/client/app/mobile/views/pages/settings.vue @@ -53,6 +53,21 @@ %i18n:@load-remote-media% %i18n:@i-am-under-limited-internet% + +
+
%i18n:@note-visibility%
+ %i18n:@remember-note-visibility% +
+
%i18n:@default-note-visibility%
+ + + + + + + +
+
@@ -161,6 +176,11 @@ export default Vue.extend({ set(value) { this.$store.commit('device/set', { key: 'mobileNotificationPosition', value }); } }, + defaultNoteVisibility: { + get() { return this.$store.state.settings.defaultNoteVisibility; }, + set(value) { this.$store.commit('settings/set', { key: 'defaultNoteVisibility', value }); } + }, + lightmode: { get() { return this.$store.state.device.lightmode; }, set(value) { this.$store.commit('device/set', { key: 'lightmode', value }); } @@ -198,6 +218,13 @@ export default Vue.extend({ }); }, + onChangeRememberNoteVisibility(v) { + this.$store.dispatch('settings/set', { + key: 'rememberNoteVisibility', + value: v + }); + }, + onChangeDisableViaMobile(v) { this.$store.dispatch('settings/set', { key: 'disableViaMobile', diff --git a/src/client/app/store.ts b/src/client/app/store.ts index 16ce78ea9..22de9b558 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -26,6 +26,8 @@ const defaultSettings = { disableViaMobile: false, memo: null, iLikeSushi: false, + rememberNoteVisibility: false, + defaultNoteVisibility: 'public', games: { reversi: { showBoardLabels: false,