real-time update: adjust replyCount up/down

this also fixes the connecting lines in the Sk-style view

thanks @ShittyKopper for reporting the bug!

NOTE: at this point, the `isDeletedRef` boolean is pretty much
useless, because we're directly removing deleted notes from the
`replies` array and therefore from the DOM (we were just hiding them,
before); I'm intentionally not touching `isDeletedRef` to simplify
merges from upstream
This commit is contained in:
dakkar 2023-12-21 16:00:59 +00:00
parent d06939bd25
commit 576a87118c
5 changed files with 53 additions and 10 deletions

View file

@ -14,7 +14,8 @@ export function useNoteCapture(props: {
note: Ref<Misskey.entities.Note>;
pureNote: Ref<Misskey.entities.Note>;
isDeletedRef: Ref<boolean>;
onReplyCallback: (note, replyNote: Misskey.entities.Note) => void | undefined;
onReplyCallback: (replyNote: Misskey.entities.Note) => void | undefined;
onDeleteCallback: (id: Misskey.entities.Note['id']) => void | undefined;
}) {
const note = props.note;
const pureNote = props.pureNote !== undefined ? props.pureNote : props.note;
@ -33,7 +34,7 @@ export function useNoteCapture(props: {
noteId: body.id,
});
await props.onReplyCallback(pureNote, replyNote);
await props.onReplyCallback(replyNote);
break;
}
@ -88,6 +89,8 @@ export function useNoteCapture(props: {
case 'deleted': {
props.isDeletedRef.value = true;
if (props.onDeleteCallback) await props.onDeleteCallback(id);
break;
}