mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 07:38:07 -05:00
set canRemix and canSaveAsCopy
This commit is contained in:
parent
fdeab4de05
commit
ed7b6541e9
1 changed files with 7 additions and 6 deletions
|
@ -545,7 +545,8 @@ Preview.defaultProps = {
|
|||
};
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const projectInfoPresent = Object.keys(state.preview.projectInfo).length > 0;
|
||||
const projectInfoPresent = state.preview.projectInfo &&
|
||||
Object.keys(state.preview.projectInfo).length > 0 && state.preview.projectInfo.id > 0;
|
||||
const userPresent = state.session.session.user !== null &&
|
||||
typeof state.session.session.user !== 'undefined' &&
|
||||
Object.keys(state.session.session.user).length > 0;
|
||||
|
@ -558,15 +559,15 @@ const mapStateToProps = state => {
|
|||
state.session.session.user.id === state.preview.projectInfo.author.id;
|
||||
|
||||
return {
|
||||
canAddToStudio: isLoggedIn && userOwnsProject,
|
||||
canAddToStudio: userOwnsProject,
|
||||
canCreateNew: true,
|
||||
canRemix: false,
|
||||
canRemix: isLoggedIn && projectInfoPresent && !userOwnsProject,
|
||||
canReport: isLoggedIn && !userOwnsProject,
|
||||
canSave: isLoggedIn && (userOwnsProject || !state.preview.projectInfo.id),
|
||||
canSaveAsCopy: false,
|
||||
canSave: isLoggedIn && (userOwnsProject || !projectInfoPresent), // can save a new project
|
||||
canSaveAsCopy: userOwnsProject && projectInfoPresent,
|
||||
canShare: userOwnsProject && state.permissions.social,
|
||||
comments: state.preview.comments,
|
||||
enableCommunity: state.preview.projectInfo && state.preview.projectInfo.id > 0,
|
||||
enableCommunity: projectInfoPresent,
|
||||
faved: state.preview.faved,
|
||||
fullScreen: state.scratchGui.mode.isFullScreen,
|
||||
// project is editable iff logged in user is the author of the project, or
|
||||
|
|
Loading…
Reference in a new issue