diff --git a/client/modules/IDE/pages/IDEView.jsx b/client/modules/IDE/pages/IDEView.jsx index 9ff8351d..c427f4c5 100644 --- a/client/modules/IDE/pages/IDEView.jsx +++ b/client/modules/IDE/pages/IDEView.jsx @@ -92,7 +92,7 @@ class IDEView extends React.Component { } componentDidUpdate(prevProps) { - if (this.isUserOwner() && this.props.project.id) { + if (this.isUserOwner(this.props) && this.props.project.id) { if (this.props.preferences.autosave && this.props.ide.unsavedChanges && !this.props.ide.justOpenedProject) { if ( this.props.selectedFile.name === prevProps.selectedFile.name && @@ -123,21 +123,19 @@ class IDEView extends React.Component { this.autosaveInterval = null; } - getTitle = () => { - const { id } = this.props.project; - return id ? `p5.js Web Editor | ${this.props.project.name}` : 'p5.js Web Editor'; + getTitle = (props) => { + const { id } = props.project; + return id ? `p5.js Web Editor | ${props.project.name}` : 'p5.js Web Editor'; } - isUserOwner() { - return this.props.project.owner && this.props.project.owner.id === this.props.user.id; - } + isUserOwner = props => props.project.owner && props.project.owner.id === props.user.id; handleGlobalKeydown(e) { // 83 === s if (e.keyCode === 83 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) { e.preventDefault(); e.stopPropagation(); - if (this.isUserOwner() || (this.props.user.authenticated && !this.props.project.owner)) { + if (this.isUserOwner(this.props) || (this.props.user.authenticated && !this.props.project.owner)) { this.props.saveProject(this.cmController.getContent()); } else if (this.props.user.authenticated) { this.props.cloneProject(); @@ -208,7 +206,7 @@ class IDEView extends React.Component { return (
- {this.getTitle()} + {this.getTitle(this.props)} {this.props.toast.isVisible && }