mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
Merge pull request #3244 from LLK/hotfix/no-confirm-admin
Allow admins to delete comments without confirmation
This commit is contained in:
commit
d4f5ac7d09
3 changed files with 12 additions and 1 deletions
|
@ -54,7 +54,11 @@ class Comment extends React.Component {
|
|||
}
|
||||
|
||||
handleDelete () {
|
||||
this.setState({deleting: true});
|
||||
if (this.props.canDeleteWithoutConfirm) {
|
||||
this.props.onDelete(this.props.id);
|
||||
} else {
|
||||
this.setState({deleting: true});
|
||||
}
|
||||
}
|
||||
|
||||
handleConfirmDelete () {
|
||||
|
@ -267,6 +271,7 @@ Comment.propTypes = {
|
|||
username: PropTypes.string
|
||||
}),
|
||||
canDelete: PropTypes.bool,
|
||||
canDeleteWithoutConfirm: PropTypes.bool,
|
||||
canReply: PropTypes.bool,
|
||||
canReport: PropTypes.bool,
|
||||
canRestore: PropTypes.bool,
|
||||
|
|
|
@ -74,6 +74,7 @@ class TopLevelComment extends React.Component {
|
|||
const {
|
||||
author,
|
||||
canDelete,
|
||||
canDeleteWithoutConfirm,
|
||||
canReply,
|
||||
canReport,
|
||||
canRestore,
|
||||
|
@ -103,6 +104,7 @@ class TopLevelComment extends React.Component {
|
|||
content,
|
||||
datetimeCreated,
|
||||
canDelete,
|
||||
canDeleteWithoutConfirm,
|
||||
canReply,
|
||||
canReport,
|
||||
canRestore,
|
||||
|
@ -126,6 +128,7 @@ class TopLevelComment extends React.Component {
|
|||
<Comment
|
||||
author={reply.author}
|
||||
canDelete={canDelete}
|
||||
canDeleteWithoutConfirm={canDeleteWithoutConfirm}
|
||||
canReply={canReply}
|
||||
canReport={canReport}
|
||||
canRestore={canRestore && parentVisible}
|
||||
|
@ -168,6 +171,7 @@ TopLevelComment.propTypes = {
|
|||
username: PropTypes.string
|
||||
}),
|
||||
canDelete: PropTypes.bool,
|
||||
canDeleteWithoutConfirm: PropTypes.bool,
|
||||
canReply: PropTypes.bool,
|
||||
canReport: PropTypes.bool,
|
||||
canRestore: PropTypes.bool,
|
||||
|
@ -190,6 +194,7 @@ TopLevelComment.propTypes = {
|
|||
};
|
||||
|
||||
TopLevelComment.defaultProps = {
|
||||
canDeleteWithoutConfirm: false,
|
||||
defaultExpanded: false,
|
||||
moreRepliesToLoad: false
|
||||
};
|
||||
|
|
|
@ -599,6 +599,7 @@ const PreviewPresentation = ({
|
|||
<TopLevelComment
|
||||
author={comment.author}
|
||||
canDelete={canDeleteComments}
|
||||
canDeleteWithoutConfirm={isAdmin}
|
||||
canReply={isLoggedIn && projectInfo.comments_allowed && isShared}
|
||||
canReport={isLoggedIn}
|
||||
canRestore={canRestoreComments}
|
||||
|
|
Loading…
Reference in a new issue