diff options
author | Dessalines <tyhou13@gmx.com> | 2019-10-19 17:46:29 -0700 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-10-19 17:46:29 -0700 |
commit | 02dd9ac32a491e7ee41a012b11ff90666455066b (patch) | |
tree | 446a4d3acff2b3b7f17e6ce3a9555143a6f79d53 /ui/src/components/comment-node.tsx | |
parent | 5547ecdeafe09be78c76236fbf01e73c638addf2 (diff) |
Adding username mentions / tagging from comments.
- Fixes #293
Diffstat (limited to 'ui/src/components/comment-node.tsx')
-rw-r--r-- | ui/src/components/comment-node.tsx | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index 7eb5d9d4..e3d82196 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -4,6 +4,7 @@ import { CommentNode as CommentNodeI, CommentLikeForm, CommentForm as CommentFormI, + EditUserMentionForm, SaveCommentForm, BanFromCommunityForm, BanUserForm, @@ -686,16 +687,25 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { } handleMarkRead(i: CommentNode) { - let form: CommentFormI = { - content: i.props.node.comment.content, - edit_id: i.props.node.comment.id, - creator_id: i.props.node.comment.creator_id, - post_id: i.props.node.comment.post_id, - parent_id: i.props.node.comment.parent_id, - read: !i.props.node.comment.read, - auth: null, - }; - WebSocketService.Instance.editComment(form); + // if it has a user_mention_id field, then its a mention + if (i.props.node.comment.user_mention_id) { + let form: EditUserMentionForm = { + user_mention_id: i.props.node.comment.user_mention_id, + read: !i.props.node.comment.read, + }; + WebSocketService.Instance.editUserMention(form); + } else { + let form: CommentFormI = { + content: i.props.node.comment.content, + edit_id: i.props.node.comment.id, + creator_id: i.props.node.comment.creator_id, + post_id: i.props.node.comment.post_id, + parent_id: i.props.node.comment.parent_id, + read: !i.props.node.comment.read, + auth: null, + }; + WebSocketService.Instance.editComment(form); + } } handleModBanFromCommunityShow(i: CommentNode) { |