@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
33import { connect } from 'react-redux' ;
44import log from './log' ;
55
6-
76// eslint-disable-next-line import/no-commonjs
87const { API_HOST } = require ( './brand' ) ;
98
@@ -65,7 +64,8 @@ const TWProjectMetaFetcherHOC = function (WrappedComponent) {
6564 this . state = {
6665 canSave : false ,
6766 canRemix : false ,
68- canUseCloud : false
67+ canUseCloud : false ,
68+ canEditTitle : false
6969 } ;
7070 }
7171 componentDidUpdate ( prevProps ) {
@@ -98,10 +98,13 @@ const TWProjectMetaFetcherHOC = function (WrappedComponent) {
9898 this . props . onSetDescription ( instructions , credits ) ;
9999 }
100100
101- this . setState ( { canSave : data . canSave === 'true' } ) ;
102- // if you can save, you can edit title (it doesn't work the prop isn't passed down)
103- // this.setState({canEditTitle: true});
104- this . setState ( { canRemix : data . canRemix === 'true' } ) ;
101+ const canSave = data . canSave === 'true' ;
102+ this . setState ( {
103+ canSave : canSave ,
104+ canRemix : data . canRemix === 'true' ,
105+ canEditTitle : canSave // Enable title editing if user has save permissions
106+ } ) ;
107+
105108 storage . setCloudOTT ( data ?. cloudDataOTT ) ;
106109 storage . setCustomAchievements ( data ?. customAchievements ) ;
107110 window . CollaborationRoom = data ?. collaboratorRoom ;
@@ -135,6 +138,7 @@ const TWProjectMetaFetcherHOC = function (WrappedComponent) {
135138 canSave = { this . state . canSave }
136139 canRemix = { this . state . canRemix }
137140 canUseCloud = { this . state . canUseCloud }
141+ canEditTitle = { this . state . canEditTitle }
138142 />
139143 ) ;
140144 }
0 commit comments