mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
Merge pull request #2424 from paulkaplan/admin-toggle-comments
Allow admins to toggle comments
This commit is contained in:
commit
d20b16d79c
2 changed files with 6 additions and 4 deletions
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue