mirror of
https://github.com/wassname/talk.git
synced 2026-07-12 00:33:54 +08:00
Merge pull request #1149 from devonJS/undo-reject
undo reject comment on stream
This commit is contained in:
@@ -182,6 +182,7 @@ export default class Comment extends React.Component {
|
||||
editableUntil: PropTypes.string,
|
||||
})
|
||||
}).isRequired,
|
||||
setCommentStatus: PropTypes.func.isRequired,
|
||||
|
||||
// edit a comment, passed (id, asset_id, { body })
|
||||
editComment: PropTypes.func,
|
||||
@@ -343,7 +344,9 @@ export default class Comment extends React.Component {
|
||||
} = this.props;
|
||||
|
||||
if (!highlighted && this.commentIsRejected(comment)) {
|
||||
return <CommentTombstone action='reject' />;
|
||||
return <CommentTombstone action='reject' onUndo={() => {
|
||||
this.props.setCommentStatus({commentId: comment.id, status: 'NONE'});
|
||||
}}/>;
|
||||
}
|
||||
|
||||
if (this.commentIsIgnored(comment)) {
|
||||
|
||||
@@ -3,4 +3,10 @@
|
||||
text-align: center;
|
||||
padding: 1em;
|
||||
color: #3E4F71;
|
||||
}
|
||||
|
||||
.undo {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
margin-left: 5px;
|
||||
}
|
||||
@@ -24,6 +24,9 @@ class CommentTombstone extends React.Component {
|
||||
<hr aria-hidden={true} />
|
||||
<p className={styles.commentTombstone}>
|
||||
{this.getCopy()}
|
||||
{this.props.action === 'reject' &&
|
||||
<span className={styles.undo} onClick={this.props.onUndo}>Undo</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
@@ -32,6 +35,7 @@ class CommentTombstone extends React.Component {
|
||||
|
||||
CommentTombstone.propTypes = {
|
||||
action: PropTypes.string,
|
||||
onUndo: PropTypes.func,
|
||||
};
|
||||
|
||||
export default CommentTombstone;
|
||||
|
||||
@@ -3,6 +3,7 @@ import React from 'react';
|
||||
import Comment from '../components/Comment';
|
||||
import {withFragments} from 'coral-framework/hocs';
|
||||
import {getSlotFragmentSpreads} from 'coral-framework/utils';
|
||||
import {withSetCommentStatus} from 'coral-framework/graphql/mutations';
|
||||
import {THREADING_LEVEL} from '../constants/stream';
|
||||
import hoistStatics from 'recompose/hoistStatics';
|
||||
import {nest} from '../graphql/utils';
|
||||
@@ -130,6 +131,7 @@ const withCommentFragments = withFragments({
|
||||
const enhance = compose(
|
||||
withAnimateEnter,
|
||||
withCommentFragments,
|
||||
withSetCommentStatus,
|
||||
);
|
||||
|
||||
export default enhance(Comment);
|
||||
|
||||
Reference in New Issue
Block a user