diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-06-25 23:38:13 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-06-25 23:38:13 +0200 |
commit | e03ff516d8d2c01675848d281e76d814f7e16a82 (patch) | |
tree | 8430dd776dfb33ec4dd2c967d3e4eb509e79acc4 /sonar-server/src/main/webapp | |
parent | 21f854e6fdc628bc092752f3b785d02ae891f808 (diff) | |
download | sonarqube-e03ff516d8d2c01675848d281e76d814f7e16a82.tar.gz sonarqube-e03ff516d8d2c01675848d281e76d814f7e16a82.zip |
SONAR-5007 Fix api/profiles/index
Diffstat (limited to 'sonar-server/src/main/webapp')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb | 2 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb | 13 |
2 files changed, 5 insertions, 10 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb index f0556fd2b31..d3fecdb935e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb @@ -199,7 +199,7 @@ class Api::ProfilesController < Api::ApiController result={} result[:name]=@profile.name result[:language]=@profile.language - result[:parent]=@profile.parent_name if @profile.parent_name.present? + result[:parent]=@profile.parent_kee if @profile.parent_kee.present? result[:default]=@profile.default_profile? rules=[] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb index 5cf3a2cf369..671dd892cd8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb @@ -98,14 +98,14 @@ class Profile < ActiveRecord::Base end def inherited? - parent_name.present? + parent_kee.present? end def parent @parent||= begin - if parent_name.present? - Profile.first(:conditions => ['language=? and name=?', language, parent_name]) + if parent_kee.present? + Profile.first(:conditions => ['language=? and kee=?', language, parent_kee]) else nil end @@ -115,7 +115,7 @@ class Profile < ActiveRecord::Base def children @children ||= begin - Profile.all(:conditions => ['parent_name=? and language=?', name, language]) + Profile.all(:conditions => ['parent_kee=? and language=?', kee, language]) end end @@ -143,13 +143,8 @@ class Profile < ActiveRecord::Base def rename(new_name) old_name=self.name Profile.transaction do - children_to_be_renamed=children() self.name=new_name if save - children_to_be_renamed.each do |child| - child.parent_name=new_name - child.save - end Property.with_key("sonar.profile.#{language}").each do |prop| if prop.text_value==old_name prop.text_value=new_name |