Skip to content

Commit

Permalink
Fix(Frontend): 公開範囲の保存がおかしかったのを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyatea committed Aug 13, 2024
1 parent eda06f2 commit 2e77820
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 7 additions & 5 deletions packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ watch(showPreview, () => defaultStore.set('showPreview', showPreview.value));
const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction);
watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value));
const cw = ref<string | null>(props.initialCw ?? null);
const localOnly = ref(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility);
const localOnly = ref(props.initialLocalOnly ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : false));
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility));
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
Expand Down Expand Up @@ -368,13 +368,13 @@ const bottomItemDef = {
watch(visibility, () => {
switch (visibility.value) {
case 'public':
localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility;
localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : false;
break;
case 'home':
localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility;
localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : false;
break;
case 'followers':
localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility;
localOnly.value = props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : false;
break;
}
Expand Down Expand Up @@ -636,6 +636,9 @@ async function toggleLocalOnly() {
}
localOnly.value = !localOnly.value;
if (defaultStore.state.rememberNoteVisibility) {
defaultStore.set('localOnly', localOnly.value);
}
}
async function toggleReactionAcceptance() {
Expand Down Expand Up @@ -875,7 +878,6 @@ async function applyDraft(draft: noteDrafts.NoteDraft, native = false) {
useCw.value = draft.data.useCw;
cw.value = draft.data.cw;
visibility.value = draft.data.visibility;
localOnly.value = draft.data.localOnly;
files.value = (draft.data.files || []).filter(draftFile => draftFile);
if (draft.data.poll) {
poll.value = draft.data.poll;
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/scripts/get-note-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ export function getRenoteMenu(props: {
}

const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility;
const localOnly = defaultStore.state.rememberNoteVisibility;
const localOnly = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : false;

let visibility = appearNote.visibility;
visibility = smallerVisibility(visibility, configuredVisibility);
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ export const defaultStore = markRaw(
where: 'account',
default: false,
},
localOnly: {
where: 'deviceAccount',
default: false,
},
rememberReactionAcceptance: {
where: 'account',
default: false,
Expand Down

0 comments on commit 2e77820

Please sign in to comment.