fix for when comments don't have stats (old data / migration needed)

master
rob 2 years ago
parent 5f35d3c1da
commit 3778ff6c86

@ -85,7 +85,7 @@ mixin renderComment (comment, options)
onclick=`return dtp.app.comments.submitCommentVote(event);`,
title="Upvote this comment",
).uk-button.uk-button-link
+renderLabeledIcon('fa-chevron-up', formatCount(comment.resourceStats.upvoteCount))
+renderLabeledIcon('fa-chevron-up', formatCount(comment.resourceStats ? comment.resourceStats.upvoteCount : 0))
.uk-width-auto
button(
type="button",
@ -94,7 +94,7 @@ mixin renderComment (comment, options)
onclick=`return dtp.app.comments.submitCommentVote(event);`,
title="Downvote this comment",
).uk-button.uk-button-link
+renderLabeledIcon('fa-chevron-down', formatCount(comment.resourceStats.downvoteCount))
+renderLabeledIcon('fa-chevron-down', formatCount(comment.resourceStats ? comment.resourceStats.downvoteCount : 0))
.uk-width-auto
button(
type="button",
@ -102,7 +102,7 @@ mixin renderComment (comment, options)
onclick=`return dtp.app.comments.openReplies(event);`,
title="Load replies to this comment",
).uk-button.uk-button-link
+renderLabeledIcon('fa-comment', formatCount(comment.commentStats.replyCount))
+renderLabeledIcon('fa-comment', formatCount(comment.commentStats ? comment.commentStats.replyCount : 0))
.uk-width-auto
button(
type="button",

Loading…
Cancel
Save