From 9e5c955a2fb65e647052c904e399c5e262cdaef6 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 6 Jan 2021 16:05:42 -0500 Subject: [PATCH] Fix user mentions read. --- src/shared/components/comment-node.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/shared/components/comment-node.tsx b/src/shared/components/comment-node.tsx index c08edc3..b9de855 100644 --- a/src/shared/components/comment-node.tsx +++ b/src/shared/components/comment-node.tsx @@ -244,7 +244,7 @@ export class CommentNode extends Component { class="btn btn-link btn-animate text-muted" onClick={linkEvent(this, this.handleMarkRead)} data-tippy-content={ - cv.comment.read + this.commentOrMentionRead ? i18n.t('mark_as_unread') : i18n.t('mark_as_read') } @@ -254,7 +254,7 @@ export class CommentNode extends Component { ) : ( @@ -728,6 +728,11 @@ export class CommentNode extends Component { ); } + get commentOrMentionRead() { + let cv = this.props.node.comment_view; + return this.isUserMentionType(cv) ? cv.user_mention.read : cv.comment.read; + } + get linkBtn() { let cv = this.props.node.comment_view; return ( @@ -965,7 +970,7 @@ export class CommentNode extends Component { isUserMentionType( item: CommentView | UserMentionView ): item is UserMentionView { - return (item as UserMentionView).user_mention.id !== undefined; + return (item as UserMentionView).user_mention?.id !== undefined; } handleMarkRead(i: CommentNode) { -- 2.44.1