Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #772 from Shinsina/approved-comments-only
Browse files Browse the repository at this point in the history
Display approved comments only
  • Loading branch information
brandonbk authored Aug 31, 2023
2 parents 8b31ddd + cd07354 commit e6cff73
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/marko-web-identity-x/browser/comments/post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<div :class="element('header')">
<div :class="element('display-name')">
<span>Posted by {{ displayName }}</span>
<span v-if="!approved">(pending moderation)</span>
</div>
<div>
<span :class="element('created-at')">
Expand Down
17 changes: 13 additions & 4 deletions packages/marko-web-identity-x/browser/comments/stream.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@
/>
</div>

<h5 v-if="latestCommentsHeader && comments.length" :class="element('latest-comments')">
{{ latestCommentsHeader }} ({{ totalCount }})
<h5
v-if="latestCommentsHeader && approvedComments.length"
:class="element('latest-comments')"
>
{{ latestCommentsHeader }} ({{ approvedComments.length }})
</h5>
</div>
<div v-if="isLoading" :class="element('loading')">
Expand All @@ -59,12 +62,12 @@
<div v-else-if="error" :class="element('error')">
Unable to load comments: {{ error.message }}
</div>
<div v-else-if="comments.length === 0" :class="element('no-posts')">
<div v-else-if="approvedComments.length === 0" :class="element('no-posts')">
{{ noCommentsMessage }}
</div>
<div v-else :class="element('posts')">
<div
v-for="comment in comments"
v-for="comment in approvedComments"
:key="comment.id"
:class="element('post')"
>
Expand Down Expand Up @@ -231,6 +234,12 @@ export default {
hasActiveUser() {
return this.activeUser && this.activeUser.email;
},
/**
*
*/
approvedComments() {
return this.comments.filter((comment) => comment.approved);
},
},
/**
Expand Down

0 comments on commit e6cff73

Please sign in to comment.