From 930bb78304a9aaeef8ae5fe949bb6b1a11fa13ab Mon Sep 17 00:00:00 2001 From: rschamp Date: Fri, 11 Mar 2022 14:22:43 -0500 Subject: [PATCH] =?UTF-8?q?Handle=20Totally=20Normal=E2=84=A2=20flags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/redux/session.js | 2 ++ src/views/preview/presentation.jsx | 1 + src/views/preview/project-view.jsx | 7 +++++-- src/views/search/search.jsx | 6 +++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/redux/session.js b/src/redux/session.js index 67863dd57..2740ab6af 100644 --- a/src/redux/session.js +++ b/src/redux/session.js @@ -144,6 +144,8 @@ module.exports.selectProjectCommentsGloballyEnabled = state => get(state, ['session', 'session', 'flags', 'project_comments_enabled'], false); module.exports.selectStudioCommentsGloballyEnabled = state => 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'], {muteExpiresAt: 0, offenses: [], showWarning: false}); module.exports.selectIsMuted = state => (module.exports.selectMuteStatus(state).muteExpiresAt || 0) * 1000 > Date.now(); diff --git a/src/views/preview/presentation.jsx b/src/views/preview/presentation.jsx index ac63fc9bb..e6cf7978b 100644 --- a/src/views/preview/presentation.jsx +++ b/src/views/preview/presentation.jsx @@ -722,6 +722,7 @@ PreviewPresentation.propTypes = { favoriteCount: PropTypes.number, intl: intlShape, isAdmin: PropTypes.bool, + isTotallyNormal: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types isFullScreen: PropTypes.bool, isLoggedIn: PropTypes.bool, isNewScratcher: PropTypes.bool, diff --git a/src/views/preview/project-view.jsx b/src/views/preview/project-view.jsx index cdcdc89e4..a68485d98 100644 --- a/src/views/preview/project-view.jsx +++ b/src/views/preview/project-view.jsx @@ -27,7 +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'; +import {selectProjectCommentsGloballyEnabled, selectIsTotallyNormal} from '../../redux/session'; const navigationActions = require('../../redux/navigation.js'); const previewActions = require('../../redux/preview.js'); const projectCommentActions = require('../../redux/project-comment-actions.js'); @@ -930,6 +930,7 @@ Preview.propTypes = { handleUpdateProjectThumbnail: PropTypes.func, isAdmin: PropTypes.bool, isEditable: PropTypes.bool, + isTotallyNormal: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types isLoggedIn: PropTypes.bool, isProjectCommentsGloballyEnabled: PropTypes.bool, isNewScratcher: PropTypes.bool, @@ -1019,7 +1020,8 @@ const mapStateToProps = state => { const showEmailConfirmationBanner = state.session.session.flags && state.session.session.flags.has_outstanding_email_confirmation && 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 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 // logged in user is an admin. isEditable: isEditable, + isTotallyNormal: isTotallyNormal, isLoggedIn: isLoggedIn, isAdmin: isAdmin, isNewScratcher: isLoggedIn && state.permissions.new_scratcher, diff --git a/src/views/search/search.jsx b/src/views/search/search.jsx index a65f696ee..036f78105 100644 --- a/src/views/search/search.jsx +++ b/src/views/search/search.jsx @@ -15,6 +15,8 @@ const Select = require('../../components/forms/select.jsx'); const TitleBanner = require('../../components/title-banner/title-banner.jsx'); const Tabs = require('../../components/tabs/tabs.jsx'); +import {selectIsTotallyNormal} from '../../redux/session'; + const Page = require('../../components/page/www/page.jsx'); const render = require('../../lib/render.jsx'); @@ -258,11 +260,13 @@ class Search extends React.Component { Search.propTypes = { dispatch: PropTypes.func, intl: intlShape, + isTotallyNormal: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types searchTerm: PropTypes.string }; const mapStateToProps = state => ({ - searchTerm: state.navigation.searchTerm + searchTerm: state.navigation.searchTerm, + isTotallyNormal: selectIsTotallyNormal(state) }); const WrappedSearch = injectIntl(Search);