Merge pull request #2424 from paulkaplan/admin-toggle-comments

Allow admins to toggle comments
This commit is contained in:
Paul Kaplan 2018-12-07 16:47:01 -05:00 committed by GitHub
commit d20b16d79c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -57,6 +57,7 @@ const PreviewPresentation = ({
canRestoreComments,
canSave,
canShare,
canToggleComments,
canUseBackpack,
cloudHost,
comments,
@ -113,7 +114,6 @@ const PreviewPresentation = ({
showAdminPanel,
showModInfo,
singleCommentId,
userOwnsProject,
visibilityInfo
}) => {
const shareDate = ((projectInfo.history && projectInfo.history.shared)) ? projectInfo.history.shared : '';
@ -480,7 +480,7 @@ const PreviewPresentation = ({
<div className="comments-container">
<FlexRow className="comments-header">
<h4><FormattedMessage id="project.comments.header" /></h4>
{userOwnsProject ? (
{canToggleComments ? (
<div>
<label>
<input
@ -584,6 +584,7 @@ PreviewPresentation.propTypes = {
canRestoreComments: PropTypes.bool,
canSave: PropTypes.bool,
canShare: PropTypes.bool,
canToggleComments: PropTypes.bool,
canUseBackpack: PropTypes.bool,
cloudHost: PropTypes.string,
comments: PropTypes.arrayOf(PropTypes.object),
@ -643,7 +644,6 @@ PreviewPresentation.propTypes = {
showAdminPanel: PropTypes.bool,
showModInfo: PropTypes.bool,
singleCommentId: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
userOwnsProject: PropTypes.bool,
visibilityInfo: PropTypes.shape({
censored: PropTypes.bool,
message: PropTypes.string,

View file

@ -547,6 +547,7 @@ class Preview extends React.Component {
canRestoreComments={this.props.isAdmin}
canSave={this.props.canSave}
canShare={this.props.canShare || this.props.isAdmin}
canToggleComments={this.props.canToggleComments}
canUseBackpack={this.props.canUseBackpack}
cloudHost={this.props.cloudHost}
comments={this.props.comments}
@ -578,7 +579,6 @@ class Preview extends React.Component {
showAdminPanel={this.props.isAdmin}
showModInfo={this.props.isAdmin}
singleCommentId={this.state.singleCommentId}
userOwnsProject={this.props.userOwnsProject}
visibilityInfo={this.props.visibilityInfo}
onAddComment={this.handleAddComment}
onAddToStudioClicked={this.handleAddToStudioClick}
@ -663,6 +663,7 @@ Preview.propTypes = {
canReport: PropTypes.bool,
canSave: PropTypes.bool,
canShare: PropTypes.bool,
canToggleComments: PropTypes.bool,
canUseBackpack: PropTypes.bool,
cloudHost: PropTypes.string,
comments: PropTypes.arrayOf(PropTypes.object),
@ -778,6 +779,7 @@ const mapStateToProps = state => {
canReport: isLoggedIn && !userOwnsProject,
canSave: isLoggedIn && userOwnsProject,
canShare: userOwnsProject && state.permissions.social,
canToggleComments: userOwnsProject || isAdmin,
canUseBackpack: isLoggedIn,
comments: state.preview.comments,
enableCommunity: projectInfoPresent,