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)); watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value));
const cw = ref<string | null>(props.initialCw ?? null); const cw = ref<string | null>(props.initialCw ?? null);
const localOnly = ref<boolean>(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly); 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 visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof Misskey.noteVisibilities[number]);
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]); const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
if (props.initialVisibleUsers) { if (props.initialVisibleUsers) {
@ -290,6 +291,19 @@ watch(text, () => {
}, { immediate: true }); }, { immediate: true });
watch(visibility, () => { 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(); checkMissingMention();
}, { immediate: true }); }, { 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="followers">{{ i18n.ts._visibility.followers }}</option>
<option value="specified">{{ i18n.ts._visibility.specified }}</option> <option value="specified">{{ i18n.ts._visibility.specified }}</option>
</MkSelect> </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> </div>
</MkFolder> </MkFolder>
</div> </div>
@ -97,6 +99,8 @@ const followersVisibility = ref($i.followersVisibility);
const defaultNoteVisibility = computed(defaultStore.makeGetterSetter('defaultNoteVisibility')); const defaultNoteVisibility = computed(defaultStore.makeGetterSetter('defaultNoteVisibility'));
const defaultNoteLocalOnly = computed(defaultStore.makeGetterSetter('defaultNoteLocalOnly')); 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 rememberNoteVisibility = computed(defaultStore.makeGetterSetter('rememberNoteVisibility'));
const keepCw = computed(defaultStore.makeGetterSetter('keepCw')); const keepCw = computed(defaultStore.makeGetterSetter('keepCw'));

View File

@ -104,6 +104,14 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'account', where: 'account',
default: false, default: false,
}, },
defaultHomeNoteLocalOnly: {
where: 'account',
default: false,
},
defaultFollowersNoteLocalOnly: {
where: 'account',
default: false,
},
uploadFolder: { uploadFolder: {
where: 'account', where: 'account',
default: null as string | null, default: null as string | null,