Restrict reporting comments to logged in users

This commit is contained in:
Paul Kaplan 2018-10-17 13:19:46 -04:00
parent 7b514344fa
commit 312a9e2bff
3 changed files with 15 additions and 6 deletions

View file

@ -87,6 +87,7 @@ class Comment extends React.Component {
author,
canDelete,
canReply,
canReport,
canRestore,
content,
datetimeCreated,
@ -122,12 +123,14 @@ class Comment extends React.Component {
<FormattedMessage id="comments.delete" />
</span>
)}
<span
className="comment-report"
onClick={this.handleReport}
>
<FormattedMessage id="comments.report" />
</span>
{canReport && (
<span
className="comment-report"
onClick={this.handleReport}
>
<FormattedMessage id="comments.report" />
</span>
)}
</React.Fragment>
) : (
<React.Fragment>
@ -215,6 +218,7 @@ Comment.propTypes = {
}),
canDelete: PropTypes.bool,
canReply: PropTypes.bool,
canReport: PropTypes.bool,
canRestore: PropTypes.bool,
content: PropTypes.string,
datetimeCreated: PropTypes.string,

View file

@ -55,6 +55,7 @@ class TopLevelComment extends React.Component {
author,
canDelete,
canReply,
canReport,
canRestore,
content,
datetimeCreated,
@ -80,6 +81,7 @@ class TopLevelComment extends React.Component {
datetimeCreated,
canDelete,
canReply,
canReport,
canRestore,
id,
onDelete,
@ -102,6 +104,7 @@ class TopLevelComment extends React.Component {
author={reply.author}
canDelete={canDelete}
canReply={canReply}
canReport={canReport}
canRestore={canRestore && parentVisible}
content={reply.content}
datetimeCreated={reply.datetime_created}
@ -143,6 +146,7 @@ TopLevelComment.propTypes = {
}),
canDelete: PropTypes.bool,
canReply: PropTypes.bool,
canReport: PropTypes.bool,
canRestore: PropTypes.bool,
content: PropTypes.string,
datetimeCreated: PropTypes.string,

View file

@ -367,6 +367,7 @@ const PreviewPresentation = ({
author={comment.author}
canDelete={canDeleteComments}
canReply={isLoggedIn && projectInfo.comments_allowed}
canReport={isLoggedIn}
canRestore={canRestoreComments}
content={comment.content}
datetimeCreated={comment.datetime_created}