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:
parent
d06939bd25
commit
576a87118c
5 changed files with 53 additions and 10 deletions
|
|
@ -170,7 +170,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div v-if="!repliesLoaded" style="padding: 16px">
|
||||
<MkButton style="margin: 0 auto;" primary rounded @click="loadReplies">{{ i18n.ts.loadReplies }}</MkButton>
|
||||
</div>
|
||||
<MkNoteSub v-for="note in replies" :key="note.id" :note="note" :class="$style.reply" :detail="true" :expandAllCws="props.expandAllCws"/>
|
||||
<MkNoteSub v-for="note in replies" :key="note.id" :note="note" :class="$style.reply" :detail="true" :expandAllCws="props.expandAllCws" :onDeleteCallback="removeReply" />
|
||||
</div>
|
||||
<div v-else-if="tab === 'renotes'" :class="$style.tab_renotes">
|
||||
<MkPagination :pagination="renotesPagination" :disableAutoLoad="true">
|
||||
|
|
@ -372,8 +372,17 @@ const reactionsPagination = computed(() => ({
|
|||
},
|
||||
}));
|
||||
|
||||
async function addReplyTo(note, replyNote: Misskey.entities.Note) {
|
||||
async function addReplyTo(replyNote: Misskey.entities.Note) {
|
||||
replies.value.unshift(replyNote);
|
||||
appearNote.repliesCount += 1;
|
||||
}
|
||||
|
||||
async function removeReply(id: Misskey.entities.Note['id']) {
|
||||
const replyIdx = replies.value.findIndex(note => note.id === id);
|
||||
if (replyIdx >= 0) {
|
||||
replies.value.splice(replyIdx, 1);
|
||||
appearNote.repliesCount -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
useNoteCapture({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue