move cw settings into preferences / "posting form"

This commit is contained in:
dakkar 2025-04-14 15:56:04 +01:00
parent 65683de740
commit 4d76243662
2 changed files with 28 additions and 25 deletions

View file

@ -385,6 +385,24 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkPreferenceContainer>
</SearchMarker>
<SearchMarker :keywords="['note', 'cw']">
<MkInput v-model="defaultCW" type="text" manualSave @update:modelValue="save()">
<template #label><SearchLabel>{{ i18n.ts.defaultCW }}</SearchLabel></template>
<template #caption><SearchKeyword>{{ i18n.ts.defaultCWDescription }}</SearchKeyword></template>
</MkInput>
</SearchMarker>
<SearchMarker :keywords="['note', 'cw', 'priority']">
<MkSelect v-model="defaultCWPriority" :disabled="!defaultCW || !keepCw" @update:modelValue="save()">
<template #label><SearchLabel>{{ i18n.ts.defaultCWPriority }}</SearchLabel></template>
<template #caption><SearchKeyword>{{ i18n.ts.defaultCWPriorityDescription }}</SearchKeyword></template>
<option value="default">{{ i18n.ts._defaultCWPriority.default }}</option>
<option value="parent">{{ i18n.ts._defaultCWPriority.parent }}</option>
<option value="parentDefault">{{ i18n.ts._defaultCWPriority.parentDefault }}</option>
<option value="defaultParent">{{ i18n.ts._defaultCWPriority.defaultParent }}</option>
</MkSelect>
</SearchMarker>
<SearchMarker :keywords="['remember', 'keep', 'note', 'visibility']">
<MkPreferenceContainer k="rememberNoteVisibility">
<MkSwitch v-model="rememberNoteVisibility">
@ -902,6 +920,7 @@ import FormSection from '@/components/form/section.vue';
import FormLink from '@/components/form/link.vue';
import MkLink from '@/components/MkLink.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkInput from '@/components/MkInput.vue';
import { store } from '@/store.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js';
@ -1004,6 +1023,8 @@ const numberOfReplies = prefer.model('numberOfReplies');
const autoloadConversation = prefer.model('autoloadConversation');
const clickToOpen = prefer.model('clickToOpen');
const useCustomSearchEngine = computed(() => !Object.keys(searchEngineMap).includes(searchEngine.value));
const defaultCW = ref($i.defaultCW);
const defaultCWPriority = ref($i.defaultCWPriority);
watch(lang, () => {
miLocalStorage.setItem('lang', lang.value as string);
@ -1187,6 +1208,13 @@ async function testNotificationDot() {
}
}
function save() {
misskeyApi('i/update', {
defaultCWPriority: defaultCWPriority.value,
defaultCW: defaultCW.value,
});
}
const headerActions = computed(() => []);
const headerTabs = computed(() => []);

View file

@ -219,26 +219,6 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkFolder>
</SearchMarker>
<SearchMarker :keywords="['keep', 'cw', 'content', 'warning']">
<div class="_gaps_m">
<MkSwitch v-model="keepCw" @update:modelValue="save()"><SearchLabel>{{ i18n.ts.keepCw }}</SearchLabel></MkSwitch>
<MkInput v-model="defaultCW" type="text" manualSave @update:modelValue="save()">
<template #label><SearchLabel>{{ i18n.ts.defaultCW }}</SearchLabel></template>
<template #caption><SearchKeyword>{{ i18n.ts.defaultCWDescription }}</SearchKeyword></template>
</MkInput>
<MkSelect v-model="defaultCWPriority" :disabled="!defaultCW || !keepCw" @update:modelValue="save()">
<template #label><SearchLabel>{{ i18n.ts.defaultCWPriority }}</SearchLabel></template>
<template #caption><SearchKeyword>{{ i18n.ts.defaultCWPriorityDescription }}</SearchKeyword></template>
<option value="default">{{ i18n.ts._defaultCWPriority.default }}</option>
<option value="parent">{{ i18n.ts._defaultCWPriority.parent }}</option>
<option value="parentDefault">{{ i18n.ts._defaultCWPriority.parentDefault }}</option>
<option value="defaultParent">{{ i18n.ts._defaultCWPriority.defaultParent }}</option>
</MkSelect>
</div>
</SearchMarker>
<MkInfo warn>{{ i18n.ts._accountSettings.mayNotEffectSomeSituations }}</MkInfo>
</div>
</FormSection>
@ -285,8 +265,6 @@ const publicReactions = ref($i.publicReactions);
const followingVisibility = ref($i.followingVisibility);
const followersVisibility = ref($i.followersVisibility);
const chatScope = ref($i.chatScope);
const defaultCW = ref($i.defaultCW);
const defaultCWPriority = ref($i.defaultCWPriority);
const allowUnsignedFetch = ref($i.allowUnsignedFetch);
const computedAllowUnsignedFetch = computed(() => {
if (allowUnsignedFetch.value !== 'staff') {
@ -294,7 +272,6 @@ const computedAllowUnsignedFetch = computed(() => {
}
return instance.allowUnsignedFetch;
});
const keepCw = prefer.model('keepCw');
const makeNotesFollowersOnlyBefore_type = computed(() => {
if (makeNotesFollowersOnlyBefore.value == null) {
@ -350,8 +327,6 @@ function save() {
followingVisibility: followingVisibility.value,
followersVisibility: followersVisibility.value,
chatScope: chatScope.value,
defaultCWPriority: defaultCWPriority.value,
defaultCW: defaultCW.value,
allowUnsignedFetch: allowUnsignedFetch.value,
});
}