From: Dessalines Date: Wed, 6 Jan 2021 21:05:42 +0000 (-0500) Subject: Fix user mentions read. X-Git-Url: http://these/git/readmes/%7B%7D/static/%7B%60https:/%7BmarkdownHelpUrl%7D?a=commitdiff_plain;h=9e5c955a2fb65e647052c904e399c5e262cdaef6;p=lemmy-ui.git Fix user mentions read. --- 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) {