diff options
author | David Gageot <david@gageot.net> | 2012-05-16 15:58:58 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-05-16 15:58:58 +0200 |
commit | ed577004fe47daa335abcdd2287231400fb0dcb4 (patch) | |
tree | 45ff22387230ad279a4878c634c80d367cfe4fa0 | |
parent | 83f77332e5f178c7686e3aa7d7c4408f0fd99bb1 (diff) | |
download | sonarqube-ed577004fe47daa335abcdd2287231400fb0dcb4.tar.gz sonarqube-ed577004fe47daa335abcdd2287231400fb0dcb4.zip |
SONAR-3482 Prevent removing a filter which is used by a widget
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb index 7d08bc89a95..d5097476165 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb @@ -104,8 +104,12 @@ class FiltersController < ApplicationController access_denied unless @filter.authorized_to_edit?(self) if @filter - @filter.destroy - flash[:notice]='Filter deleted' + if WidgetProperty.find(:first, :conditions => { :kee => 'filter', :text_value => @filter.id.to_s}) + flash[:error]='The filter is used in at least one dashboard. It cannot be deleted' + else + @filter.destroy + flash[:notice]='Filter deleted' + end end redirect_to :action => 'manage' |