Merge pull request #2293 from paulkaplan/hide-backpack-logged-out

Hide backpack for logged out users
This commit is contained in:
Paul Kaplan 2018-11-14 14:13:48 -05:00 committed by GitHub
commit 805bd87706
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 16 deletions

View file

@ -44,12 +44,13 @@ const onKeyPress = e => {
const PreviewPresentation = ({ const PreviewPresentation = ({
assetHost, assetHost,
backpackOptions, backpackHost,
canAddToStudio, canAddToStudio,
canDeleteComments, canDeleteComments,
canReport, canReport,
canRestoreComments, canRestoreComments,
canShare, canShare,
canUseBackpack,
cloudHost, cloudHost,
comments, comments,
editable, editable,
@ -173,7 +174,8 @@ const PreviewPresentation = ({
<IntlGUI <IntlGUI
isPlayerOnly isPlayerOnly
assetHost={assetHost} assetHost={assetHost}
backpackOptions={backpackOptions} backpackHost={backpackHost}
backpackVisible={canUseBackpack}
basePath="/" basePath="/"
className="guiPlayer" className="guiPlayer"
cloudHost={cloudHost} cloudHost={cloudHost}
@ -444,15 +446,13 @@ const PreviewPresentation = ({
PreviewPresentation.propTypes = { PreviewPresentation.propTypes = {
addToStudioOpen: PropTypes.bool, addToStudioOpen: PropTypes.bool,
assetHost: PropTypes.string, assetHost: PropTypes.string,
backpackOptions: PropTypes.shape({ backpackHost: PropTypes.string,
host: PropTypes.string,
visible: PropTypes.bool
}),
canAddToStudio: PropTypes.bool, canAddToStudio: PropTypes.bool,
canDeleteComments: PropTypes.bool, canDeleteComments: PropTypes.bool,
canReport: PropTypes.bool, canReport: PropTypes.bool,
canRestoreComments: PropTypes.bool, canRestoreComments: PropTypes.bool,
canShare: PropTypes.bool, canShare: PropTypes.bool,
canUseBackpack: PropTypes.bool,
cloudHost: PropTypes.string, cloudHost: PropTypes.string,
comments: PropTypes.arrayOf(PropTypes.object), comments: PropTypes.arrayOf(PropTypes.object),
editable: PropTypes.bool, editable: PropTypes.bool,

View file

@ -401,12 +401,13 @@ class Preview extends React.Component {
<PreviewPresentation <PreviewPresentation
addToStudioOpen={this.state.addToStudioOpen} addToStudioOpen={this.state.addToStudioOpen}
assetHost={this.props.assetHost} assetHost={this.props.assetHost}
backpackOptions={this.props.backpackOptions} backpackHost={this.props.backpackHost}
canAddToStudio={this.props.canAddToStudio} canAddToStudio={this.props.canAddToStudio}
canDeleteComments={this.props.isAdmin || this.props.userOwnsProject} canDeleteComments={this.props.isAdmin || this.props.userOwnsProject}
canReport={this.props.canReport} canReport={this.props.canReport}
canRestoreComments={this.props.isAdmin} canRestoreComments={this.props.isAdmin}
canShare={this.props.canShare} canShare={this.props.canShare}
canUseBackpack={this.props.canUseBackpack}
cloudHost={this.props.cloudHost} cloudHost={this.props.cloudHost}
comments={this.props.comments} comments={this.props.comments}
editable={this.props.isEditable} editable={this.props.isEditable}
@ -457,7 +458,8 @@ class Preview extends React.Component {
authorId={this.props.authorId} authorId={this.props.authorId}
authorThumbnailUrl={this.props.authorThumbnailUrl} authorThumbnailUrl={this.props.authorThumbnailUrl}
authorUsername={this.props.authorUsername} authorUsername={this.props.authorUsername}
backpackOptions={this.props.backpackOptions} backpackHost={this.props.backpackHost}
backpackVisible={this.props.canUseBackpack}
basePath="/" basePath="/"
canCreateCopy={this.props.canCreateCopy} canCreateCopy={this.props.canCreateCopy}
canCreateNew={this.props.canCreateNew} canCreateNew={this.props.canCreateNew}
@ -496,10 +498,7 @@ Preview.propTypes = {
authorThumbnailUrl: PropTypes.string, authorThumbnailUrl: PropTypes.string,
// If there's no author, this will be false` // If there's no author, this will be false`
authorUsername: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]), authorUsername: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
backpackOptions: PropTypes.shape({ backpackHost: PropTypes.string,
host: PropTypes.string,
visible: PropTypes.bool
}),
canAddToStudio: PropTypes.bool, canAddToStudio: PropTypes.bool,
canCreateCopy: PropTypes.bool, canCreateCopy: PropTypes.bool,
canCreateNew: PropTypes.bool, canCreateNew: PropTypes.bool,
@ -507,6 +506,7 @@ Preview.propTypes = {
canReport: PropTypes.bool, canReport: PropTypes.bool,
canSave: PropTypes.bool, canSave: PropTypes.bool,
canShare: PropTypes.bool, canShare: PropTypes.bool,
canUseBackpack: PropTypes.bool,
cloudHost: PropTypes.string, cloudHost: PropTypes.string,
comments: PropTypes.arrayOf(PropTypes.object), comments: PropTypes.arrayOf(PropTypes.object),
enableCommunity: PropTypes.bool, enableCommunity: PropTypes.bool,
@ -570,10 +570,8 @@ Preview.propTypes = {
Preview.defaultProps = { Preview.defaultProps = {
assetHost: process.env.ASSET_HOST, assetHost: process.env.ASSET_HOST,
backpackOptions: { backpackHost: process.env.BACKPACK_HOST,
host: process.env.BACKPACK_HOST, canUseBackpack: false,
visible: true
},
cloudHost: process.env.CLOUDDATA_HOST, cloudHost: process.env.CLOUDDATA_HOST,
projectHost: process.env.PROJECT_HOST, projectHost: process.env.PROJECT_HOST,
sessionStatus: sessionActions.Status.NOT_FETCHED, sessionStatus: sessionActions.Status.NOT_FETCHED,
@ -608,6 +606,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,
canUseBackpack: isLoggedIn,
comments: state.preview.comments, comments: state.preview.comments,
enableCommunity: projectInfoPresent, enableCommunity: projectInfoPresent,
faved: state.preview.faved, faved: state.preview.faved,