From 55cbf2c66e9774205ad9295730b93a76a99ebdec Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Wed, 5 Feb 2020 09:42:58 +0900
Subject: [PATCH] =?UTF-8?q?localOnly=E3=82=92=E8=A8=98=E6=86=B6=E3=81=A7?=
 =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/client/components/post-form.vue   | 10 +++++++++-
 src/client/pages/settings/privacy.vue |  4 ++--
 src/client/store.ts                   |  6 ++++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/client/components/post-form.vue b/src/client/components/post-form.vue
index 9a13f523aa..b2c27ec5db 100644
--- a/src/client/components/post-form.vue
+++ b/src/client/components/post-form.vue
@@ -177,6 +177,12 @@ export default Vue.extend({
 		}
 	},
 
+	watch: {
+		localOnly() {
+			this.$store.commit('device/setLocalOnly', this.localOnly);
+		}
+	},
+
 	mounted() {
 		if (this.initialText) {
 			this.text = this.initialText;
@@ -209,7 +215,9 @@ export default Vue.extend({
 		}
 
 		// デフォルト公開範囲
-		this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : 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;
 
 		// 公開以外へのリプライ時は元の公開範囲を引き継ぐ
 		if (this.reply && ['home', 'followers', 'specified'].includes(this.reply.visibility)) {
diff --git a/src/client/pages/settings/privacy.vue b/src/client/pages/settings/privacy.vue
index af2c3f501b..3019f6b101 100644
--- a/src/client/pages/settings/privacy.vue
+++ b/src/client/pages/settings/privacy.vue
@@ -6,13 +6,13 @@
 		<mk-switch v-model="autoAcceptFollowed" :disabled="!isLocked" @change="save()">{{ $t('autoAcceptFollowed') }}</mk-switch>
 	</div>
 	<div class="_content">
-		<mk-select v-model="defaultNoteVisibility" style="margin-top: 8px;">
+		<mk-switch v-model="rememberNoteVisibility" @change="save()">{{ $t('rememberNoteVisibility') }}</mk-switch>
+		<mk-select v-model="defaultNoteVisibility" style="margin-bottom: 8px;" v-if="!rememberNoteVisibility">
 			<template #label>{{ $t('defaultNoteVisibility') }}</template>
 			<option value="public">{{ $t('_visibility.public') }}</option>
 			<option value="followers">{{ $t('_visibility.followers') }}</option>
 			<option value="specified">{{ $t('_visibility.specified') }}</option>
 		</mk-select>
-		<mk-switch v-model="rememberNoteVisibility" @change="save()">{{ $t('rememberNoteVisibility') }}</mk-switch>
 	</div>
 </section>
 </template>
diff --git a/src/client/store.ts b/src/client/store.ts
index c9f61b8112..73112829e1 100644
--- a/src/client/store.ts
+++ b/src/client/store.ts
@@ -24,6 +24,8 @@ const defaultDeviceSettings = {
 	useOsDefaultEmojis: false,
 	accounts: [],
 	recentEmojis: [],
+	visibility: 'public',
+	localOnly: false,
 	themes: [],
 	theme: 'light',
 };
@@ -110,6 +112,10 @@ export default (os: MiOS) => new Vuex.Store({
 				setVisibility(state, visibility) {
 					state.visibility = visibility;
 				},
+
+				setLocalOnly(state, localOnly) {
+					state.localOnly = localOnly;
+				},
 			}
 		},