]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2706 Make it possible to have actions on violations w/o review
authorFabrice Bellingard <bellingard@gmail.com>
Wed, 23 May 2012 09:13:50 +0000 (11:13 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 23 May 2012 09:14:37 +0000 (11:14 +0200)
=> Added a non-persisted "IDLE" status on Review

sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb

index f92c072c0dd9af3f24a3ceeeddd778860a97f0c1..b53541094a6b008e51251a4aed54b864dbf174c6 100644 (file)
@@ -261,15 +261,15 @@ class ProjectReviewsController < ApplicationController
   # POST
   def execute
     bad_request('Missing review id') unless params[:id]
-    review = Review.find(params[:id], :include => ['project'])
+    @review = Review.find(params[:id], :include => ['project'])
 
-    access_denied unless has_rights_to_modify?(review.resource)
+    access_denied unless has_rights_to_modify?(@review.resource)
 
     bad_request('Missing command') if params[:command].blank?
-    RuleFailure.execute_command(params[:command], review.violation, review.resource.project, current_user, params)
+    RuleFailure.execute_command(params[:command], @review.violation, @review.resource.project, current_user, params)
 
-    review.reload
-    render :partial => "project_reviews/review", :locals => {:review => review}
+    @review.reload
+    render :partial => "project_reviews/view"
   end
 
 
index bd4807142933a0727823f2a5d6f76af1661169ab..3269e34abd4e34847e943b5a41df9ef77890b8e5 100644 (file)
@@ -36,6 +36,10 @@ class Review < ActiveRecord::Base
   STATUS_RESOLVED = 'RESOLVED'
   STATUS_REOPENED = 'REOPENED'
   STATUS_CLOSED = 'CLOSED'
+  # "IDLE" is a non-persisted status of an non-existing review = when a violation does have a review yet
+  # It is currently used by rule_failure.rb (#to_java_workflow_review) to pass a list of reviews to the 
+  # review workflow, even for violations which don't have yet a review.
+  STATUS_IDLE = 'IDLE'
 
   RESOLUTION_FALSE_POSITIVE = 'FALSE-POSITIVE'
   RESOLUTION_FIXED = 'FIXED'
index 75b285928bdd0eab9a5394fedc02d05a9bb87e3e..421c2e6ef9bdb7175498bdde25d47144fe9eac60 100644 (file)
@@ -291,6 +291,8 @@ class RuleFailure < ActiveRecord::Base
       java_review.setAssigneeId(review.assignee_id)
       java_review.setManual(review.manual_violation)
       java_review.setPropertiesAsString(review.data)
+    else
+      java_review.setStatus(Review::STATUS_IDLE)
     end
     java_review
   end