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"
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: "リモートサーバーのメディアを表示する"

View File

@ -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();
},

View File

@ -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,

View File

@ -26,6 +26,22 @@
<mk-switch v-model="autoPopout" text="%i18n:@auto-popout%">
<span>%i18n:@auto-popout-desc%</span>
</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>
<summary>%i18n:@advanced%</summary>
<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 }); }
},
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

View File

@ -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,

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="lightmode">%i18n:@i-am-under-limited-internet%</ui-switch>
</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>
@ -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',

View File

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