Improve note visibility settings

Closes #2312
Closes #2313
This commit is contained in:
syuilo 2018-09-07 21:13:15 +09:00
parent 05413b3f10
commit af3b0ec2bf
7 changed files with 78 additions and 4 deletions

View file

@ -73,6 +73,16 @@ common:
rip: "RIP" rip: "RIP"
pudding: "Pudding" pudding: "Pudding"
note-visibility:
public: "公開"
home: "ホーム"
home-desc: "ホームタイムラインにのみ公開"
followers: "フォロワー"
followers-desc: "自分のフォロワーにのみ公開"
specified: "ダイレクト"
specified-desc: "指定したユーザーにのみ公開"
private: "非公開"
note-placeholders: note-placeholders:
a: "今どうしてる?" a: "今どうしてる?"
b: "何かありましたか?" b: "何かありましたか?"
@ -724,6 +734,9 @@ desktop/views/components/settings.vue:
behaviour: "動作" behaviour: "動作"
fetch-on-scroll: "スクロールで自動読み込み" fetch-on-scroll: "スクロールで自動読み込み"
fetch-on-scroll-desc: "ページを下までスクロールしたときに自動で追加のコンテンツを読み込みます。" fetch-on-scroll-desc: "ページを下までスクロールしたときに自動で追加のコンテンツを読み込みます。"
note-visibility: "投稿の公開範囲"
default-note-visibility: "デフォルトの公開範囲"
remember-note-visibility: "投稿の公開範囲を記憶する"
auto-popout: "ウィンドウの自動ポップアウト" auto-popout: "ウィンドウの自動ポップアウト"
auto-popout-desc: "ウィンドウが開かれるとき、ポップアウト(ブラウザ外に切り離す)可能なら自動でポップアウトします。この設定はブラウザに記憶されます。" auto-popout-desc: "ウィンドウが開かれるとき、ポップアウト(ブラウザ外に切り離す)可能なら自動でポップアウトします。この設定はブラウザに記憶されます。"
advanced: "詳細設定" advanced: "詳細設定"
@ -1365,6 +1378,9 @@ mobile/views/pages/settings.vue:
notification-position-top: "上" notification-position-top: "上"
behavior: "動作" behavior: "動作"
fetch-on-scroll: "スクロールで自動読み込み" fetch-on-scroll: "スクロールで自動読み込み"
note-visibility: "投稿の公開範囲"
default-note-visibility: "デフォルトの公開範囲"
remember-note-visibility: "投稿の公開範囲を記憶する"
disable-via-mobile: "「モバイルからの投稿」フラグを付けない" disable-via-mobile: "「モバイルからの投稿」フラグを付けない"
load-raw-images: "添付された画像を高画質で表示する" load-raw-images: "添付された画像を高画質で表示する"
load-remote-media: "リモートサーバーのメディアを表示する" load-remote-media: "リモートサーバーのメディアを表示する"

View file

@ -47,7 +47,7 @@ export default Vue.extend({
props: ['source', 'compact'], props: ['source', 'compact'],
data() { data() {
return { 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() { mounted() {
@ -97,7 +97,9 @@ export default Vue.extend({
}, },
methods: { methods: {
choose(visibility) { 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.$emit('chosen', visibility);
this.$destroy(); this.$destroy();
}, },

View file

@ -100,7 +100,7 @@ export default Vue.extend({
useCw: false, useCw: false,
cw: null, cw: null,
geo: 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: [], visibleUsers: [],
autocomplete: null, autocomplete: null,
draghover: false, draghover: false,

View file

@ -26,6 +26,22 @@
<mk-switch v-model="autoPopout" text="%i18n:@auto-popout%"> <mk-switch v-model="autoPopout" text="%i18n:@auto-popout%">
<span>%i18n:@auto-popout-desc%</span> <span>%i18n:@auto-popout-desc%</span>
</mk-switch> </mk-switch>
<section>
<header>%i18n:@note-visibility%</header>
<mk-switch v-model="$store.state.settings.rememberNoteVisibility" @change="onChangeRememberNoteVisibility" text="%i18n:@remember-note-visibility%"/>
<section>
<header>%i18n:@default-note-visibility%</header>
<ui-select v-model="defaultNoteVisibility">
<option value="public">%i18n:common.note-visibility.public%</option>
<option value="home">%i18n:common.note-visibility.home%</option>
<option value="followers">%i18n:common.note-visibility.followers%</option>
<option value="specified">%i18n:common.note-visibility.specified%</option>
<option value="private">%i18n:common.note-visibility.private%</option>
</ui-select>
</section>
</section>
<details> <details>
<summary>%i18n:@advanced%</summary> <summary>%i18n:@advanced%</summary>
<mk-switch v-model="apiViaStream" text="%i18n:@api-via-stream%"> <mk-switch v-model="apiViaStream" text="%i18n:@api-via-stream%">
@ -239,6 +255,11 @@ export default Vue.extend({
set(value) { this.$store.commit('device/set', { key: 'apiViaStream', value }); } 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: { autoPopout: {
get() { return this.$store.state.device.autoPopout; }, get() { return this.$store.state.device.autoPopout; },
set(value) { this.$store.commit('device/set', { key: 'autoPopout', value }); } set(value) { this.$store.commit('device/set', { key: 'autoPopout', value }); }
@ -312,6 +333,12 @@ export default Vue.extend({
value: v value: v
}); });
}, },
onChangeRememberNoteVisibility(v) {
this.$store.dispatch('settings/set', {
key: 'rememberNoteVisibility',
value: v
});
},
onChangeAutoWatch(v) { onChangeAutoWatch(v) {
(this as any).api('i/update', { (this as any).api('i/update', {
autoWatch: v autoWatch: v

View file

@ -95,7 +95,7 @@ export default Vue.extend({
files: [], files: [],
poll: false, poll: false,
geo: 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: [], visibleUsers: [],
useCw: false, useCw: false,
cw: null, cw: null,

View file

@ -53,6 +53,21 @@
<ui-switch v-model="$store.state.settings.loadRemoteMedia" @change="onChangeLoadRemoteMedia">%i18n:@load-remote-media%</ui-switch> <ui-switch v-model="$store.state.settings.loadRemoteMedia" @change="onChangeLoadRemoteMedia">%i18n:@load-remote-media%</ui-switch>
<ui-switch v-model="lightmode">%i18n:@i-am-under-limited-internet%</ui-switch> <ui-switch v-model="lightmode">%i18n:@i-am-under-limited-internet%</ui-switch>
</section> </section>
<section>
<header>%i18n:@note-visibility%</header>
<ui-switch v-model="$store.state.settings.rememberNoteVisibility" @change="onChangeRememberNoteVisibility">%i18n:@remember-note-visibility%</ui-switch>
<section>
<header>%i18n:@default-note-visibility%</header>
<ui-select v-model="defaultNoteVisibility">
<option value="public">%i18n:common.note-visibility.public%</option>
<option value="home">%i18n:common.note-visibility.home%</option>
<option value="followers">%i18n:common.note-visibility.followers%</option>
<option value="specified">%i18n:common.note-visibility.specified%</option>
<option value="private">%i18n:common.note-visibility.private%</option>
</ui-select>
</section>
</section>
</ui-card> </ui-card>
<ui-card> <ui-card>
@ -161,6 +176,11 @@ export default Vue.extend({
set(value) { this.$store.commit('device/set', { key: 'mobileNotificationPosition', value }); } 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: { lightmode: {
get() { return this.$store.state.device.lightmode; }, get() { return this.$store.state.device.lightmode; },
set(value) { this.$store.commit('device/set', { key: 'lightmode', value }); } 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) { onChangeDisableViaMobile(v) {
this.$store.dispatch('settings/set', { this.$store.dispatch('settings/set', {
key: 'disableViaMobile', key: 'disableViaMobile',

View file

@ -26,6 +26,8 @@ const defaultSettings = {
disableViaMobile: false, disableViaMobile: false,
memo: null, memo: null,
iLikeSushi: false, iLikeSushi: false,
rememberNoteVisibility: false,
defaultNoteVisibility: 'public',
games: { games: {
reversi: { reversi: {
showBoardLabels: false, showBoardLabels: false,