localOnly

This commit is contained in:
mattyatea 2024-01-23 13:06:33 +09:00
parent 78a34d3de3
commit 0eacd5e1f7
3 changed files with 27 additions and 1 deletions

View file

@ -208,6 +208,7 @@ const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction);
watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value));
const cw = ref<string | null>(props.initialCw ?? null);
const localOnly = ref<boolean>(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<Misskey.entities.UserDetailed[]>([]);
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 });

View file

@ -61,7 +61,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="followers">{{ i18n.ts._visibility.followers }}</option>
<option value="specified">{{ i18n.ts._visibility.specified }}</option>
</MkSelect>
<MkSwitch v-model="defaultNoteLocalOnly">{{ i18n.ts._visibility.disableFederation }}</MkSwitch>
<MkSwitch v-model="defaultNoteLocalOnly">{{ i18n.ts._visibility.public }}+{{ i18n.ts._visibility.disableFederation }}</MkSwitch>
<MkSwitch v-model="defaultHomeNoteLocalOnly">{{ i18n.ts._visibility.home }}+{{ i18n.ts._visibility.disableFederation }}</MkSwitch>
<MkSwitch v-model="defaultFollowersNoteLocalOnly">{{ i18n.ts._visibility.followers }}+{{ i18n.ts._visibility.disableFederation }}</MkSwitch>
</div>
</MkFolder>
</div>
@ -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'));

View file

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