@@ -14,6 +14,7 @@ import { logoutUser } from '../modules/User/actions';
14
14
15
15
import getConfig from '../utils/getConfig' ;
16
16
import { metaKeyName , } from '../utils/metaKey' ;
17
+ import { getIsUserOwner } from '../modules/IDE/selectors/users' ;
17
18
18
19
import CaretLeftIcon from '../images/left-arrow.svg' ;
19
20
import TriangleIcon from '../images/down-filled-triangle.svg' ;
@@ -215,10 +216,6 @@ class Nav extends React.PureComponent {
215
216
}
216
217
}
217
218
218
- isUserOwner ( ) {
219
- return this . props . project . owner && this . props . project . owner . id === this . props . user . id ;
220
- }
221
-
222
219
handleFocus ( dropdown ) {
223
220
this . clearHideTimeout ( ) ;
224
221
this . setDropdown ( dropdown ) ;
@@ -283,7 +280,7 @@ class Nav extends React.PureComponent {
283
280
{ this . props . t ( 'Nav.File.New' ) }
284
281
</ button >
285
282
</ li >
286
- { getConfig ( 'LOGIN_ENABLED' ) && ( ! this . props . project . owner || this . isUserOwner ( ) ) &&
283
+ { getConfig ( 'LOGIN_ENABLED' ) && ( ! this . props . project . owner || this . props . isUserOwner ) &&
287
284
< li className = "nav__dropdown-item" >
288
285
< button
289
286
onClick = { this . handleSave }
@@ -566,16 +563,6 @@ class Nav extends React.PureComponent {
566
563
</ button >
567
564
< ul className = "nav__dropdown" >
568
565
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 >
579
566
< li className = "nav__dropdown-item" >
580
567
< button
581
568
onFocus = { this . handleFocusForLang }
@@ -807,6 +794,7 @@ Nav.propTypes = {
807
794
t : PropTypes . func . isRequired ,
808
795
setLanguage : PropTypes . func . isRequired ,
809
796
language : PropTypes . string . isRequired ,
797
+ isUserOwner : PropTypes . bool . isRequired
810
798
} ;
811
799
812
800
Nav . defaultProps = {
@@ -828,7 +816,8 @@ function mapStateToProps(state) {
828
816
user : state . user ,
829
817
unsavedChanges : state . ide . unsavedChanges ,
830
818
rootFile : state . files . filter ( file => file . name === 'root' ) [ 0 ] ,
831
- language : state . preferences . language
819
+ language : state . preferences . language ,
820
+ isUserOwner : getIsUserOwner ( state )
832
821
} ;
833
822
}
834
823
0 commit comments