@@ -14,6 +14,7 @@ import { logoutUser } from '../modules/User/actions';
1414
1515import getConfig from '../utils/getConfig' ;
1616import { metaKeyName , } from '../utils/metaKey' ;
17+ import { getIsUserOwner } from '../modules/IDE/selectors/users' ;
1718
1819import CaretLeftIcon from '../images/left-arrow.svg' ;
1920import TriangleIcon from '../images/down-filled-triangle.svg' ;
@@ -215,10 +216,6 @@ class Nav extends React.PureComponent {
215216 }
216217 }
217218
218- isUserOwner ( ) {
219- return this . props . project . owner && this . props . project . owner . id === this . props . user . id ;
220- }
221-
222219 handleFocus ( dropdown ) {
223220 this . clearHideTimeout ( ) ;
224221 this . setDropdown ( dropdown ) ;
@@ -283,7 +280,7 @@ class Nav extends React.PureComponent {
283280 { this . props . t ( 'Nav.File.New' ) }
284281 </ button >
285282 </ li >
286- { getConfig ( 'LOGIN_ENABLED' ) && ( ! this . props . project . owner || this . isUserOwner ( ) ) &&
283+ { getConfig ( 'LOGIN_ENABLED' ) && ( ! this . props . project . owner || this . props . isUserOwner ) &&
287284 < li className = "nav__dropdown-item" >
288285 < button
289286 onClick = { this . handleSave }
@@ -566,16 +563,6 @@ class Nav extends React.PureComponent {
566563 </ button >
567564 < ul className = "nav__dropdown" >
568565
569- < li className = "nav__dropdown-item" >
570- < button
571- onFocus = { this . handleFocusForLang }
572- onBlur = { this . handleBlur }
573- value = "it"
574- onClick = { e => this . handleLangSelection ( e ) }
575- >
576- Italian (Test Fallback)
577- </ button >
578- </ li >
579566 < li className = "nav__dropdown-item" >
580567 < button
581568 onFocus = { this . handleFocusForLang }
@@ -807,6 +794,7 @@ Nav.propTypes = {
807794 t : PropTypes . func . isRequired ,
808795 setLanguage : PropTypes . func . isRequired ,
809796 language : PropTypes . string . isRequired ,
797+ isUserOwner : PropTypes . bool . isRequired
810798} ;
811799
812800Nav . defaultProps = {
@@ -828,7 +816,8 @@ function mapStateToProps(state) {
828816 user : state . user ,
829817 unsavedChanges : state . ide . unsavedChanges ,
830818 rootFile : state . files . filter ( file => file . name === 'root' ) [ 0 ] ,
831- language : state . preferences . language
819+ language : state . preferences . language ,
820+ isUserOwner : getIsUserOwner ( state )
832821 } ;
833822}
834823
0 commit comments