mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-26 06:11:15 +00:00
Fix user mentions read.
This commit is contained in:
parent
23291cc51f
commit
9e5c955a2f
1 changed files with 8 additions and 3 deletions
|
@ -244,7 +244,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
class="btn btn-link btn-animate text-muted"
|
class="btn btn-link btn-animate text-muted"
|
||||||
onClick={linkEvent(this, this.handleMarkRead)}
|
onClick={linkEvent(this, this.handleMarkRead)}
|
||||||
data-tippy-content={
|
data-tippy-content={
|
||||||
cv.comment.read
|
this.commentOrMentionRead
|
||||||
? i18n.t('mark_as_unread')
|
? i18n.t('mark_as_unread')
|
||||||
: i18n.t('mark_as_read')
|
: i18n.t('mark_as_read')
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
) : (
|
) : (
|
||||||
<svg
|
<svg
|
||||||
class={`icon icon-inline ${
|
class={`icon icon-inline ${
|
||||||
cv.comment.read && 'text-success'
|
this.commentOrMentionRead && 'text-success'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<use xlinkHref="#icon-check"></use>
|
<use xlinkHref="#icon-check"></use>
|
||||||
|
@ -728,6 +728,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get commentOrMentionRead() {
|
||||||
|
let cv = this.props.node.comment_view;
|
||||||
|
return this.isUserMentionType(cv) ? cv.user_mention.read : cv.comment.read;
|
||||||
|
}
|
||||||
|
|
||||||
get linkBtn() {
|
get linkBtn() {
|
||||||
let cv = this.props.node.comment_view;
|
let cv = this.props.node.comment_view;
|
||||||
return (
|
return (
|
||||||
|
@ -965,7 +970,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
isUserMentionType(
|
isUserMentionType(
|
||||||
item: CommentView | UserMentionView
|
item: CommentView | UserMentionView
|
||||||
): item is UserMentionView {
|
): item is UserMentionView {
|
||||||
return (item as UserMentionView).user_mention.id !== undefined;
|
return (item as UserMentionView).user_mention?.id !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleMarkRead(i: CommentNode) {
|
handleMarkRead(i: CommentNode) {
|
||||||
|
|
Loading…
Reference in a new issue