]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2380 The "violations" web service API must not return
authorFabrice Bellingard <bellingard@gmail.com>
Thu, 21 Apr 2011 13:17:53 +0000 (15:17 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Thu, 21 Apr 2011 16:40:48 +0000 (18:40 +0200)
"false-positive" violation

sonar-server/src/main/webapp/WEB-INF/app/controllers/api/violations_controller.rb

index d114af18ba47572c5390e13854ff129380c67c33..01d521b251c48de8c603a69db9645842bb76bbc8 100644 (file)
@@ -73,6 +73,14 @@ class Api::ViolationsController < Api::ResourceRestController
         Sonar::RulePriority.id(p)
       end.compact
     end
+    
+    if params[:switched_off] && params[:switched_off] == "true"
+      conditions << 'switched_off=:switched_off'
+      values[:switched_off] = true
+    else
+      conditions << '(switched_off IS NULL OR switched_off=:switched_off)'
+      values[:switched_off] = false
+    end
 
     limit = (params[:limit] ? [params[:limit].to_i,5000].min : 5000) 
     violations = RuleFailure.find(:all,