summaryrefslogtreecommitdiffstats
path: root/webapp/components/rhs_comment.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/rhs_comment.jsx')
-rw-r--r--webapp/components/rhs_comment.jsx37
1 files changed, 34 insertions, 3 deletions
diff --git a/webapp/components/rhs_comment.jsx b/webapp/components/rhs_comment.jsx
index c9588eb33..dcd5ee37f 100644
--- a/webapp/components/rhs_comment.jsx
+++ b/webapp/components/rhs_comment.jsx
@@ -30,6 +30,7 @@ export default class RhsComment extends React.Component {
super(props);
this.handlePermalink = this.handlePermalink.bind(this);
+ this.removePost = this.removePost.bind(this);
this.flagPost = this.flagPost.bind(this);
this.unflagPost = this.unflagPost.bind(this);
@@ -41,6 +42,23 @@ export default class RhsComment extends React.Component {
GlobalActions.showGetPostLinkModal(this.props.post);
}
+ removePost() {
+ GlobalActions.emitRemovePost(this.props.post);
+ }
+
+ createRemovePostButton() {
+ return (
+ <a
+ href='#'
+ className='post__remove theme'
+ type='button'
+ onClick={this.removePost}
+ >
+ {'×'}
+ </a>
+ );
+ }
+
shouldComponentUpdate(nextProps) {
if (nextProps.status !== this.props.status) {
return true;
@@ -344,6 +362,21 @@ export default class RhsComment extends React.Component {
);
}
+ let options;
+ if (Utils.isPostEphemeral(post)) {
+ options = (
+ <li className='col col__remove'>
+ {this.createRemovePostButton()}
+ </li>
+ );
+ } else {
+ options = (
+ <li className='col col__reply'>
+ {dropdown}
+ </li>
+ );
+ }
+
return (
<div className={'post post--thread ' + currentUserCss + ' ' + compactClass}>
<div className='post__content'>
@@ -368,9 +401,7 @@ export default class RhsComment extends React.Component {
</time>
{flagTrigger}
</li>
- <li className='col col__reply'>
- {dropdown}
- </li>
+ {options}
</ul>
<div className='post__body'>
<div className={postClass}>