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 () {
|
handleDelete () {
|
||||||
this.setState({deleting: true});
|
if (this.props.canDeleteWithoutConfirm) {
|
||||||
|
this.props.onDelete(this.props.id);
|
||||||
|
} else {
|
||||||
|
this.setState({deleting: true});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleConfirmDelete () {
|
handleConfirmDelete () {
|
||||||
|
@ -267,6 +271,7 @@ Comment.propTypes = {
|
||||||
username: PropTypes.string
|
username: PropTypes.string
|
||||||
}),
|
}),
|
||||||
canDelete: PropTypes.bool,
|
canDelete: PropTypes.bool,
|
||||||
|
canDeleteWithoutConfirm: PropTypes.bool,
|
||||||
canReply: PropTypes.bool,
|
canReply: PropTypes.bool,
|
||||||
canReport: PropTypes.bool,
|
canReport: PropTypes.bool,
|
||||||
canRestore: PropTypes.bool,
|
canRestore: PropTypes.bool,
|
||||||
|
|
|
@ -74,6 +74,7 @@ class TopLevelComment extends React.Component {
|
||||||
const {
|
const {
|
||||||
author,
|
author,
|
||||||
canDelete,
|
canDelete,
|
||||||
|
canDeleteWithoutConfirm,
|
||||||
canReply,
|
canReply,
|
||||||
canReport,
|
canReport,
|
||||||
canRestore,
|
canRestore,
|
||||||
|
@ -103,6 +104,7 @@ class TopLevelComment extends React.Component {
|
||||||
content,
|
content,
|
||||||
datetimeCreated,
|
datetimeCreated,
|
||||||
canDelete,
|
canDelete,
|
||||||
|
canDeleteWithoutConfirm,
|
||||||
canReply,
|
canReply,
|
||||||
canReport,
|
canReport,
|
||||||
canRestore,
|
canRestore,
|
||||||
|
@ -126,6 +128,7 @@ class TopLevelComment extends React.Component {
|
||||||
<Comment
|
<Comment
|
||||||
author={reply.author}
|
author={reply.author}
|
||||||
canDelete={canDelete}
|
canDelete={canDelete}
|
||||||
|
canDeleteWithoutConfirm={canDeleteWithoutConfirm}
|
||||||
canReply={canReply}
|
canReply={canReply}
|
||||||
canReport={canReport}
|
canReport={canReport}
|
||||||
canRestore={canRestore && parentVisible}
|
canRestore={canRestore && parentVisible}
|
||||||
|
@ -168,6 +171,7 @@ TopLevelComment.propTypes = {
|
||||||
username: PropTypes.string
|
username: PropTypes.string
|
||||||
}),
|
}),
|
||||||
canDelete: PropTypes.bool,
|
canDelete: PropTypes.bool,
|
||||||
|
canDeleteWithoutConfirm: PropTypes.bool,
|
||||||
canReply: PropTypes.bool,
|
canReply: PropTypes.bool,
|
||||||
canReport: PropTypes.bool,
|
canReport: PropTypes.bool,
|
||||||
canRestore: PropTypes.bool,
|
canRestore: PropTypes.bool,
|
||||||
|
@ -190,6 +194,7 @@ TopLevelComment.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
TopLevelComment.defaultProps = {
|
TopLevelComment.defaultProps = {
|
||||||
|
canDeleteWithoutConfirm: false,
|
||||||
defaultExpanded: false,
|
defaultExpanded: false,
|
||||||
moreRepliesToLoad: false
|
moreRepliesToLoad: false
|
||||||
};
|
};
|
||||||
|
|
|
@ -599,6 +599,7 @@ const PreviewPresentation = ({
|
||||||
<TopLevelComment
|
<TopLevelComment
|
||||||
author={comment.author}
|
author={comment.author}
|
||||||
canDelete={canDeleteComments}
|
canDelete={canDeleteComments}
|
||||||
|
canDeleteWithoutConfirm={isAdmin}
|
||||||
canReply={isLoggedIn && projectInfo.comments_allowed && isShared}
|
canReply={isLoggedIn && projectInfo.comments_allowed && isShared}
|
||||||
canReport={isLoggedIn}
|
canReport={isLoggedIn}
|
||||||
canRestore={canRestoreComments}
|
canRestore={canRestoreComments}
|
||||||
|
|
Loading…
Reference in a new issue