aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-12-09 10:05:57 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-12-09 14:28:10 +0100
commitd4679b41fd1e399ab456b92f22d4ba32ad82259f (patch)
tree9ac424a19fda5e6201473fc5056d163e128e4aa1 /server/sonar-web/src/main
parent977242ca23b3ac74ef6fdb08d6e65a1a54b65159 (diff)
downloadsonarqube-d4679b41fd1e399ab456b92f22d4ba32ad82259f.tar.gz
sonarqube-d4679b41fd1e399ab456b92f22d4ba32ad82259f.zip
do not use "canBeFavorite" from api/navigation/component
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/app/components/ProjectContainer.js4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js3
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavFavorite.js14
3 files changed, 14 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/app/components/ProjectContainer.js b/server/sonar-web/src/main/js/app/components/ProjectContainer.js
index 44d64f0cd9e..41eaec1e7db 100644
--- a/server/sonar-web/src/main/js/app/components/ProjectContainer.js
+++ b/server/sonar-web/src/main/js/app/components/ProjectContainer.js
@@ -40,8 +40,8 @@ class ProjectContainer extends React.Component {
}
render () {
- // check `canBeFavorite` to be sure that /api/navigation/component has been already called
- if (!this.props.project || this.props.project.canBeFavorite == null) {
+ // check `breadcrumbs` to be sure that /api/navigation/component has been already called
+ if (!this.props.project || this.props.project.breadcrumbs == null) {
return null;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js
index 5e3057b65ff..689f4fc760f 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js
@@ -69,8 +69,7 @@ export default React.createClass({
<div className="container">
<ComponentNavFavorite
component={this.props.component.key}
- favorite={this.props.component.isFavorite}
- canBeFavorite={this.props.component.canBeFavorite}/>
+ favorite={this.props.component.isFavorite}/>
<ComponentNavBreadcrumbs
breadcrumbs={this.props.component.breadcrumbs}/>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavFavorite.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavFavorite.js
index 9e9cb8bfe1d..e5ac6b7cbe6 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavFavorite.js
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavFavorite.js
@@ -18,15 +18,17 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
+import { connect } from 'react-redux';
import Favorite from '../../../../components/controls/Favorite';
+import { getCurrentUser } from '../../../store/rootReducer';
-export default class ComponentNavFavorite extends React.Component {
+class ComponentNavFavorite extends React.Component {
static propTypes = {
- canBeFavorite: React.PropTypes.bool.isRequired
+ currentUser: React.PropTypes.object.isRequired
};
render () {
- if (!this.props.canBeFavorite) {
+ if (!this.props.currentUser.isLoggedIn) {
return null;
}
@@ -39,3 +41,9 @@ export default class ComponentNavFavorite extends React.Component {
);
}
}
+
+const mapStateToProps = state => ({
+ currentUser: getCurrentUser(state)
+});
+
+export default connect(mapStateToProps)(ComponentNavFavorite);