mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
Handle Totally Normal™ flags
This commit is contained in:
parent
413d3e0f11
commit
930bb78304
4 changed files with 13 additions and 3 deletions
|
@ -144,6 +144,8 @@ module.exports.selectProjectCommentsGloballyEnabled = state =>
|
||||||
get(state, ['session', 'session', 'flags', 'project_comments_enabled'], false);
|
get(state, ['session', 'session', 'flags', 'project_comments_enabled'], false);
|
||||||
module.exports.selectStudioCommentsGloballyEnabled = state =>
|
module.exports.selectStudioCommentsGloballyEnabled = state =>
|
||||||
get(state, ['session', 'session', 'flags', 'gallery_comments_enabled'], false);
|
get(state, ['session', 'session', 'flags', 'gallery_comments_enabled'], false);
|
||||||
|
module.exports.selectIsTotallyNormal = state =>
|
||||||
|
get(state, ['session', 'session', 'flags', 'everything_is_totally_normal'], false);
|
||||||
module.exports.selectMuteStatus = state => get(state, ['session', 'session', 'permissions', 'mute_status'],
|
module.exports.selectMuteStatus = state => get(state, ['session', 'session', 'permissions', 'mute_status'],
|
||||||
{muteExpiresAt: 0, offenses: [], showWarning: false});
|
{muteExpiresAt: 0, offenses: [], showWarning: false});
|
||||||
module.exports.selectIsMuted = state => (module.exports.selectMuteStatus(state).muteExpiresAt || 0) * 1000 > Date.now();
|
module.exports.selectIsMuted = state => (module.exports.selectMuteStatus(state).muteExpiresAt || 0) * 1000 > Date.now();
|
||||||
|
|
|
@ -722,6 +722,7 @@ PreviewPresentation.propTypes = {
|
||||||
favoriteCount: PropTypes.number,
|
favoriteCount: PropTypes.number,
|
||||||
intl: intlShape,
|
intl: intlShape,
|
||||||
isAdmin: PropTypes.bool,
|
isAdmin: PropTypes.bool,
|
||||||
|
isTotallyNormal: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types
|
||||||
isFullScreen: PropTypes.bool,
|
isFullScreen: PropTypes.bool,
|
||||||
isLoggedIn: PropTypes.bool,
|
isLoggedIn: PropTypes.bool,
|
||||||
isNewScratcher: PropTypes.bool,
|
isNewScratcher: PropTypes.bool,
|
||||||
|
|
|
@ -27,7 +27,7 @@ const NotAvailable = require('../../components/not-available/not-available.jsx')
|
||||||
const Meta = require('./meta.jsx');
|
const Meta = require('./meta.jsx');
|
||||||
|
|
||||||
const sessionActions = require('../../redux/session.js');
|
const sessionActions = require('../../redux/session.js');
|
||||||
import {selectProjectCommentsGloballyEnabled} from '../../redux/session';
|
import {selectProjectCommentsGloballyEnabled, selectIsTotallyNormal} from '../../redux/session';
|
||||||
const navigationActions = require('../../redux/navigation.js');
|
const navigationActions = require('../../redux/navigation.js');
|
||||||
const previewActions = require('../../redux/preview.js');
|
const previewActions = require('../../redux/preview.js');
|
||||||
const projectCommentActions = require('../../redux/project-comment-actions.js');
|
const projectCommentActions = require('../../redux/project-comment-actions.js');
|
||||||
|
@ -930,6 +930,7 @@ Preview.propTypes = {
|
||||||
handleUpdateProjectThumbnail: PropTypes.func,
|
handleUpdateProjectThumbnail: PropTypes.func,
|
||||||
isAdmin: PropTypes.bool,
|
isAdmin: PropTypes.bool,
|
||||||
isEditable: PropTypes.bool,
|
isEditable: PropTypes.bool,
|
||||||
|
isTotallyNormal: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types
|
||||||
isLoggedIn: PropTypes.bool,
|
isLoggedIn: PropTypes.bool,
|
||||||
isProjectCommentsGloballyEnabled: PropTypes.bool,
|
isProjectCommentsGloballyEnabled: PropTypes.bool,
|
||||||
isNewScratcher: PropTypes.bool,
|
isNewScratcher: PropTypes.bool,
|
||||||
|
@ -1019,6 +1020,7 @@ const mapStateToProps = state => {
|
||||||
const showEmailConfirmationBanner = state.session.session.flags &&
|
const showEmailConfirmationBanner = state.session.session.flags &&
|
||||||
state.session.session.flags.has_outstanding_email_confirmation &&
|
state.session.session.flags.has_outstanding_email_confirmation &&
|
||||||
state.session.session.flags.confirm_email_banner;
|
state.session.session.flags.confirm_email_banner;
|
||||||
|
const isTotallyNormal = state.session.session.flags && selectIsTotallyNormal(state);
|
||||||
|
|
||||||
// if we don't have projectInfo, assume it's shared until we know otherwise
|
// if we don't have projectInfo, assume it's shared until we know otherwise
|
||||||
const isShared = !projectInfoPresent || state.preview.projectInfo.is_published;
|
const isShared = !projectInfoPresent || state.preview.projectInfo.is_published;
|
||||||
|
@ -1046,6 +1048,7 @@ const mapStateToProps = state => {
|
||||||
// project is editable iff logged in user is the author of the project, or
|
// project is editable iff logged in user is the author of the project, or
|
||||||
// logged in user is an admin.
|
// logged in user is an admin.
|
||||||
isEditable: isEditable,
|
isEditable: isEditable,
|
||||||
|
isTotallyNormal: isTotallyNormal,
|
||||||
isLoggedIn: isLoggedIn,
|
isLoggedIn: isLoggedIn,
|
||||||
isAdmin: isAdmin,
|
isAdmin: isAdmin,
|
||||||
isNewScratcher: isLoggedIn && state.permissions.new_scratcher,
|
isNewScratcher: isLoggedIn && state.permissions.new_scratcher,
|
||||||
|
|
|
@ -15,6 +15,8 @@ const Select = require('../../components/forms/select.jsx');
|
||||||
const TitleBanner = require('../../components/title-banner/title-banner.jsx');
|
const TitleBanner = require('../../components/title-banner/title-banner.jsx');
|
||||||
const Tabs = require('../../components/tabs/tabs.jsx');
|
const Tabs = require('../../components/tabs/tabs.jsx');
|
||||||
|
|
||||||
|
import {selectIsTotallyNormal} from '../../redux/session';
|
||||||
|
|
||||||
const Page = require('../../components/page/www/page.jsx');
|
const Page = require('../../components/page/www/page.jsx');
|
||||||
const render = require('../../lib/render.jsx');
|
const render = require('../../lib/render.jsx');
|
||||||
|
|
||||||
|
@ -258,11 +260,13 @@ class Search extends React.Component {
|
||||||
Search.propTypes = {
|
Search.propTypes = {
|
||||||
dispatch: PropTypes.func,
|
dispatch: PropTypes.func,
|
||||||
intl: intlShape,
|
intl: intlShape,
|
||||||
|
isTotallyNormal: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types
|
||||||
searchTerm: PropTypes.string
|
searchTerm: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
searchTerm: state.navigation.searchTerm
|
searchTerm: state.navigation.searchTerm,
|
||||||
|
isTotallyNormal: selectIsTotallyNormal(state)
|
||||||
});
|
});
|
||||||
|
|
||||||
const WrappedSearch = injectIntl(Search);
|
const WrappedSearch = injectIntl(Search);
|
||||||
|
|
Loading…
Reference in a new issue