From 8a73d970ffc6fd334a1a88121e12790a85f12648 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 7 Feb 2017 11:22:13 +0100 Subject: [PATCH] SONAR-8661 display organizations for favorites --- .../src/main/js/app/components/nav/global/SearchView.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/nav/global/SearchView.js b/server/sonar-web/src/main/js/app/components/nav/global/SearchView.js index 4976ff11348..3b5801873c9 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/SearchView.js +++ b/server/sonar-web/src/main/js/app/components/nav/global/SearchView.js @@ -163,12 +163,16 @@ export default Marionette.LayoutView.extend({ }, fetchFavorite (): Promise<*> { + const customOrganizations = areThereCustomOrganizations(); return getFavorites().then(r => { this.favorite = r.favorites.map(f => { + const showOrganization = customOrganizations && f.organization != null; + const organization = showOrganization ? getOrganization(f.organization) : null; return { url: window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + window.dashboardParameters(true), name: f.name, - icon: 'favorite' + icon: 'favorite', + organization }; }); this.favorite = sortBy(this.favorite, 'name'); @@ -181,8 +185,7 @@ export default Marionette.LayoutView.extend({ const history = recentHistory.map((historyItem, index) => { const url = window.baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + window.dashboardParameters(true); - const showOrganization = customOrganizations && historyItem.organization != null && - historyItem.icon.toUpperCase() === 'TRK'; + const showOrganization = customOrganizations && historyItem.organization != null; // $FlowFixMe flow doesn't check the above condition on `historyItem.organization != null` const organization = showOrganization ? getOrganization(historyItem.organization) : null; return { -- 2.39.5