fix: #3357 now the comment deletion and comment updates are seen directly after the event is triggered.

This commit is contained in:
Hannes Heine 2020-08-06 16:18:27 +02:00
parent d513fec7fe
commit 7f8be5deab

View File

@ -1,15 +1,12 @@
<template>
<div id="comments" class="comment-list">
<h3 class="title">
<counter-icon
icon="comments"
:count="postComments.filter((comment) => !comment.deleted).length"
/>
<counter-icon icon="comments" :count="commentsCount" />
{{ $t('common.comment', null, 0) }}
</h3>
<div v-if="postComments" id="comments" class="comments">
<div v-if="post.comments" id="comments" class="comments">
<comment-card
v-for="comment in postComments"
v-for="comment in post.comments"
:key="comment.id"
:comment="comment"
:postId="post.id"
@ -42,6 +39,14 @@ export default {
postComments() {
return (this.post && this.post.comments) || []
},
commentsCount() {
return (
(this.post &&
this.post.comments &&
this.post.comments.filter((comment) => !comment.deleted && !comment.disabled).length) ||
0
)
},
},
methods: {
reply(message) {
@ -51,7 +56,7 @@ export default {
return anchor === '#comments'
},
updateCommentList(updatedComment) {
this.postComments = this.postComments.map((comment) => {
this.post.comments = this.post.comments.map((comment) => {
return comment.id === updatedComment.id ? updatedComment : comment
})
},