Commit 993dd36a authored by picklesrus's avatar picklesrus

WIP of being able to turn off project comments.

parent 61cf2b5b
......@@ -6,7 +6,6 @@
padding: 1.75rem 3rem 2rem;
margin: .5rem 0 2.25rem;
background-color: $ui-blue-10percent;
width: 100%;
text-align: center;
p {
......
......@@ -128,6 +128,8 @@ module.exports.selectToken = state => get(state, ['session', 'session', 'user',
module.exports.selectIsAdmin = state => get(state, ['session', 'session', 'permissions', 'admin'], false);
module.exports.selectIsSocial = state => get(state, ['session', 'session', 'permissions', 'social'], false);
module.exports.selectIsEducator = state => get(state, ['session', 'session', 'permissions', 'educator'], false);
module.exports.selectProjectCommentsGloballyEnabled = state =>
get(state, ['session', 'session', 'flags', 'project_comments_enabled'], false);
// NB logged out user id as NaN so that it can never be used in equality testing since NaN !== NaN
module.exports.selectUserId = state => get(state, ['session', 'session', 'user', 'id'], NaN);
......@@ -13,6 +13,7 @@
"project.comments.toggleOff": "Commenting off",
"project.comments.toggleOn": "Commenting on",
"project.comments.turnedOff": "Sorry, comment posting has been turned off for this project.",
"project.comments.turnedOffGlobally": "Project comments across Scratch are turned off, but don't worry, your comments are saved and will be back soon.",
"project.share.notShared": "This project is not shared — so only you can see it. Click share to let everyone see it!",
"project.share.sharedLong": "Congratulations on sharing your project! Other people can now try it out, give comments, and remix it.",
"project.share.sharedShort": "Your project is now shared.",
......
This diff is collapsed.
......@@ -257,6 +257,10 @@ $stage-width: 480px;
.comments-allowed-input {
margin-right: 3px;
}
.comment-placeholder-img {
width: 100%;
}
}
.remix-button,
......
......@@ -27,6 +27,7 @@ const NotAvailable = require('../../components/not-available/not-available.jsx')
const Meta = require('./meta.jsx');
const sessionActions = require('../../redux/session.js');
import {selectProjectCommentsGloballyEnabled} from '../../redux/session';
const navigationActions = require('../../redux/navigation.js');
const previewActions = require('../../redux/preview.js');
const projectCommentActions = require('../../redux/project-comment-actions.js');
......@@ -109,6 +110,7 @@ class Preview extends React.Component {
socialOpen: false,
favoriteCount: 0,
isProjectLoaded: false,
isProjectCommentsGloballyEnabled: false,
isRemixing: false,
invalidProject: parts.length === 1,
justRemixed: false,
......@@ -738,6 +740,7 @@ class Preview extends React.Component {
isFullScreen={this.props.fullScreen}
isLoggedIn={this.props.isLoggedIn}
isNewScratcher={this.props.isNewScratcher}
isProjectCommentsGloballyEnabled={this.props.isProjectCommentsGloballyEnabled}
isProjectLoaded={this.state.isProjectLoaded}
isRemixing={this.state.isRemixing}
isScratcher={this.props.isScratcher}
......@@ -980,6 +983,9 @@ const mapStateToProps = state => {
const isEditable = isLoggedIn &&
(authorUsername === state.session.session.user.username ||
state.permissions.admin === true);
const haveSession = state.session.session.flags;
const areCommentsOn = haveSession && selectProjectCommentsGloballyEnabled(state);
// if we don't have projectInfo, assume it's shared until we know otherwise
const isShared = !projectInfoPresent || state.preview.projectInfo.is_published;
......@@ -1010,6 +1016,7 @@ const mapStateToProps = state => {
isLoggedIn: isLoggedIn,
isAdmin: isAdmin,
isNewScratcher: isLoggedIn && state.permissions.new_scratcher,
isProjectCommentsGloballyEnabled: areCommentsOn,
isScratcher: isLoggedIn && state.permissions.scratcher,
isShared: isShared,
loved: state.preview.loved,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment