]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9005 apply feedback to the organization rules (#1976)
authorStas Vilchik <stas-vilchik@users.noreply.github.com>
Wed, 26 Apr 2017 06:51:46 +0000 (08:51 +0200)
committerGitHub <noreply@github.com>
Wed, 26 Apr 2017 06:51:46 +0000 (08:51 +0200)
* pass organization to /api/rules/show
* completely disable custom rules when orgs are enabled

server/sonar-web/src/main/js/apps/coding-rules/controller.js
server/sonar-web/src/main/js/apps/coding-rules/init.js

index dd15fb39b92dd924e303fca2ba7aaff79e00e588..5f61c68dda90dbe1ce80562370abe2c9a7c32d26 100644 (file)
@@ -114,6 +114,9 @@ export default Controller.extend({
       key: rule.id,
       actives: true
     };
+    if (this.app.organization) {
+      options.organization = this.app.organization;
+    }
     return $.get(url, options).done(data => {
       rule.set(data.rule);
       rule.addExtraAttributes(that.app.repositories);
index e3e23817c059e62775f2d8cb164489cd565cda13..6dab31d13b6d35ca41d1502674a9eb5b3e04c8e2 100644 (file)
@@ -33,6 +33,7 @@ import WorkspaceListView from './workspace-list-view';
 import WorkspaceHeaderView from './workspace-header-view';
 import FacetsView from './facets-view';
 import FiltersView from './filters-view';
+import { areThereCustomOrganizations } from '../../store/organizations/utils';
 
 const App = new Marionette.Application();
 
@@ -43,10 +44,11 @@ App.on('start', function(
     isDefaultOrganization: boolean
   }
 ) {
+  App.organization = options.organization;
   const data = options.organization ? { organization: options.organization } : {};
   $.get(window.baseUrl + '/api/rules/app', data)
     .done(r => {
-      App.customRules = options.organization == null || options.isDefaultOrganization;
+      App.customRules = !areThereCustomOrganizations();
       App.canWrite = r.canWrite;
       App.organization = options.organization;
       App.qualityProfiles = sortBy(r.qualityprofiles, ['name', 'lang']);