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

View file

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