@@ -92,7 +92,7 @@ class IDEView extends React.Component {
9292 }
9393
9494 componentDidUpdate ( prevProps ) {
95- if ( this . isUserOwner ( ) && this . props . project . id ) {
95+ if ( this . isUserOwner ( this . props ) && this . props . project . id ) {
9696 if ( this . props . preferences . autosave && this . props . ide . unsavedChanges && ! this . props . ide . justOpenedProject ) {
9797 if (
9898 this . props . selectedFile . name === prevProps . selectedFile . name &&
@@ -123,21 +123,19 @@ class IDEView extends React.Component {
123123 this . autosaveInterval = null ;
124124 }
125125
126- getTitle = ( ) => {
127- const { id } = this . props . project ;
128- return id ? `p5.js Web Editor | ${ this . props . project . name } ` : 'p5.js Web Editor' ;
126+ getTitle = ( props ) => {
127+ const { id } = props . project ;
128+ return id ? `p5.js Web Editor | ${ props . project . name } ` : 'p5.js Web Editor' ;
129129 }
130130
131- isUserOwner ( ) {
132- return this . props . project . owner && this . props . project . owner . id === this . props . user . id ;
133- }
131+ isUserOwner = props => props . project . owner && props . project . owner . id === props . user . id ;
134132
135133 handleGlobalKeydown ( e ) {
136134 // 83 === s
137135 if ( e . keyCode === 83 && ( ( e . metaKey && this . isMac ) || ( e . ctrlKey && ! this . isMac ) ) ) {
138136 e . preventDefault ( ) ;
139137 e . stopPropagation ( ) ;
140- if ( this . isUserOwner ( ) || ( this . props . user . authenticated && ! this . props . project . owner ) ) {
138+ if ( this . isUserOwner ( this . props ) || ( this . props . user . authenticated && ! this . props . project . owner ) ) {
141139 this . props . saveProject ( this . cmController . getContent ( ) ) ;
142140 } else if ( this . props . user . authenticated ) {
143141 this . props . cloneProject ( ) ;
@@ -208,7 +206,7 @@ class IDEView extends React.Component {
208206 return (
209207 < div className = "ide" >
210208 < Helmet >
211- < title > { this . getTitle ( ) } </ title >
209+ < title > { this . getTitle ( this . props ) } </ title >
212210 </ Helmet >
213211 { this . props . toast . isVisible && < Toast /> }
214212 < Nav
@@ -313,7 +311,7 @@ class IDEView extends React.Component {
313311 isExpanded = { this . props . ide . sidebarIsExpanded }
314312 expandSidebar = { this . props . expandSidebar }
315313 collapseSidebar = { this . props . collapseSidebar }
316- isUserOwner = { this . isUserOwner ( ) }
314+ isUserOwner = { this . isUserOwner ( this . props ) }
317315 clearConsole = { this . props . clearConsole }
318316 consoleEvents = { this . props . console }
319317 showRuntimeErrorWarning = { this . props . showRuntimeErrorWarning }
0 commit comments