fix handling of note objects in NoteSimple and NoteSub

This commit is contained in:
bunnybeam 2025-06-19 19:56:44 +01:00
parent 1a14424be8
commit 487cfed5f3
No known key found for this signature in database
4 changed files with 22 additions and 20 deletions

View file

@ -131,7 +131,9 @@ const props = withDefaults(defineProps<{
onDeleteCallback: undefined,
});
const appearNote = computed(() => getAppearNote(props.note));
const note = ref(deepClone(props.note));
const appearNote = computed(() => getAppearNote(note.value));
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || appearNote.value.userId === $i?.id);
@ -161,8 +163,6 @@ const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', null);
const note = ref(deepClone(props.note));
setupNoteViewInterruptors(note, isDeleted);
async function addReplyTo(replyNote: Misskey.entities.Note) {
@ -171,7 +171,7 @@ async function addReplyTo(replyNote: Misskey.entities.Note) {
}
async function removeReply(id: Misskey.entities.Note['id']) {
const replyIdx = replies.value.findIndex(note => note.id === id);
const replyIdx = replies.value.findIndex(reply => reply.id === id);
if (replyIdx >= 0) {
replies.value.splice(replyIdx, 1);
appearNote.value.repliesCount -= 1;
@ -267,11 +267,11 @@ function like(): void {
}
}
function undoReact(note): void {
const oldReaction = note.myReaction;
function undoReact(targetNote: Misskey.entities.Note): void {
const oldReaction = targetNote.myReaction;
if (!oldReaction) return;
misskeyApi('notes/reactions/delete', {
noteId: note.id,
noteId: targetNote.id,
});
}