0
0

fix(frontend): 連合なしの状態の読み書きができない問題 (#13777)

* fix: 連合なしの状態の読み書きができない問題

* update changelog

* fix types: https://github.com/misskey-dev/misskey/pull/13777#discussion_r1585901601
This commit is contained in:
taiy 2024-05-01 15:29:38 +09:00 committed by GitHub
parent ef630df443
commit 9f66f22953
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 9 deletions

View File

@ -56,6 +56,7 @@
- Fix: ページのOGP URLが間違っているのを修正 - Fix: ページのOGP URLが間違っているのを修正
- Fix: リバーシの対局を正しく共有できないことがある問題を修正 - Fix: リバーシの対局を正しく共有できないことがある問題を修正
- Fix: 通知をグループ化している際に、人数が正常に表示されないことがある問題を修正 - Fix: 通知をグループ化している際に、人数が正常に表示されないことがある問題を修正
- Fix: 連合なしの状態の読み書きができない問題を修正
### Server ### Server
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに

View File

@ -156,6 +156,7 @@ const props = withDefaults(defineProps<{
initialVisibleUsers: () => [], initialVisibleUsers: () => [],
autofocus: true, autofocus: true,
mock: false, mock: false,
initialLocalOnly: undefined,
}); });
provide('mock', props.mock); provide('mock', props.mock);
@ -185,8 +186,8 @@ watch(showPreview, () => defaultStore.set('showPreview', showPreview.value));
const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction); 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(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));
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]); const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
if (props.initialVisibleUsers) { if (props.initialVisibleUsers) {
props.initialVisibleUsers.forEach(pushVisibleUser); props.initialVisibleUsers.forEach(pushVisibleUser);
@ -518,6 +519,9 @@ async function toggleLocalOnly() {
} }
localOnly.value = !localOnly.value; localOnly.value = !localOnly.value;
if (defaultStore.state.rememberNoteVisibility) {
defaultStore.set('localOnly', localOnly.value);
}
} }
async function toggleReactionAcceptance() { async function toggleReactionAcceptance() {

View File

@ -15,7 +15,7 @@ import * as Misskey from 'misskey-js';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import MkPostForm from '@/components/MkPostForm.vue'; import MkPostForm from '@/components/MkPostForm.vue';
const props = defineProps<{ const props = withDefaults(defineProps<{
reply?: Misskey.entities.Note; reply?: Misskey.entities.Note;
renote?: Misskey.entities.Note; renote?: Misskey.entities.Note;
channel?: any; // TODO channel?: any; // TODO
@ -31,7 +31,9 @@ const props = defineProps<{
instant?: boolean; instant?: boolean;
fixed?: boolean; fixed?: boolean;
autofocus?: boolean; autofocus?: boolean;
}>(); }>(), {
initialLocalOnly: undefined,
});
const emit = defineEmits<{ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;

View File

@ -492,10 +492,9 @@ export function getNoteMenu(props: {
}; };
} }
type Visibility = 'public' | 'home' | 'followers' | 'specified'; type Visibility = (typeof Misskey.noteVisibilities)[number];
// defaultStore.state.visibilityがstringなためstringも受け付けている function smallerVisibility(a: Visibility, b: Visibility): Visibility {
function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility {
if (a === 'specified' || b === 'specified') return 'specified'; if (a === 'specified' || b === 'specified') return 'specified';
if (a === 'followers' || b === 'followers') return 'followers'; if (a === 'followers' || b === 'followers') return 'followers';
if (a === 'home' || b === 'home') return 'home'; if (a === 'home' || b === 'home') return 'home';

View File

@ -94,7 +94,7 @@ export const defaultStore = markRaw(new Storage('base', {
}, },
defaultNoteVisibility: { defaultNoteVisibility: {
where: 'account', where: 'account',
default: 'public', default: 'public' as (typeof Misskey.noteVisibilities)[number],
}, },
defaultNoteLocalOnly: { defaultNoteLocalOnly: {
where: 'account', where: 'account',
@ -150,7 +150,7 @@ export const defaultStore = markRaw(new Storage('base', {
}, },
visibility: { visibility: {
where: 'deviceAccount', where: 'deviceAccount',
default: 'public' as 'public' | 'home' | 'followers' | 'specified', default: 'public' as (typeof Misskey.noteVisibilities)[number],
}, },
localOnly: { localOnly: {
where: 'deviceAccount', where: 'deviceAccount',