From 0eacd5e1f7ea6c63cd9a171ffab3c6d5991544a1 Mon Sep 17 00:00:00 2001 From: mattyatea Date: Tue, 23 Jan 2024 13:06:33 +0900 Subject: [PATCH] localOnly --- packages/frontend/src/components/MkPostForm.vue | 14 ++++++++++++++ packages/frontend/src/pages/settings/privacy.vue | 6 +++++- packages/frontend/src/store.ts | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 2eaf88446d..529257b682 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -208,6 +208,7 @@ const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction); watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value)); const cw = ref(props.initialCw ?? null); const localOnly = ref(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly); + const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof Misskey.noteVisibilities[number]); const visibleUsers = ref([]); if (props.initialVisibleUsers) { @@ -290,6 +291,19 @@ watch(text, () => { }, { immediate: true }); watch(visibility, () => { + + switch (visibility.value) { + case 'public': + localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly; + break; + case 'home': + localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultHomeNoteLocalOnly; + break; + case 'followers': + localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultFollowersNoteLocalOnly; + break; + } + checkMissingMention(); }, { immediate: true }); diff --git a/packages/frontend/src/pages/settings/privacy.vue b/packages/frontend/src/pages/settings/privacy.vue index 3698590d51..732770c691 100644 --- a/packages/frontend/src/pages/settings/privacy.vue +++ b/packages/frontend/src/pages/settings/privacy.vue @@ -61,7 +61,9 @@ SPDX-License-Identifier: AGPL-3.0-only - {{ i18n.ts._visibility.disableFederation }} + {{ i18n.ts._visibility.public }}+{{ i18n.ts._visibility.disableFederation }} + {{ i18n.ts._visibility.home }}+{{ i18n.ts._visibility.disableFederation }} + {{ i18n.ts._visibility.followers }}+{{ i18n.ts._visibility.disableFederation }} @@ -97,6 +99,8 @@ const followersVisibility = ref($i.followersVisibility); const defaultNoteVisibility = computed(defaultStore.makeGetterSetter('defaultNoteVisibility')); const defaultNoteLocalOnly = computed(defaultStore.makeGetterSetter('defaultNoteLocalOnly')); +const defaultHomeNoteLocalOnly = computed(defaultStore.makeGetterSetter('defaultHomeNoteLocalOnly')); +const defaultFollowersNoteLocalOnly = computed(defaultStore.makeGetterSetter('defaultFollowersNoteLocalOnly')); const rememberNoteVisibility = computed(defaultStore.makeGetterSetter('rememberNoteVisibility')); const keepCw = computed(defaultStore.makeGetterSetter('keepCw')); diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 16f85aed0f..cb5f1b3416 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -104,6 +104,14 @@ export const defaultStore = markRaw(new Storage('base', { where: 'account', default: false, }, + defaultHomeNoteLocalOnly: { + where: 'account', + default: false, + }, + defaultFollowersNoteLocalOnly: { + where: 'account', + default: false, + }, uploadFolder: { where: 'account', default: null as string | null,