]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2426 Allow to directly assign a violation to users
authorFabrice Bellingard <bellingard@gmail.com>
Thu, 19 May 2011 07:58:46 +0000 (09:58 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Thu, 19 May 2011 08:03:44 +0000 (10:03 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_comment_form.html.erb

index 2fe120b3e34e4c0ffd02f7e9a38f6a226727758b..d4680a507d46217eeca04bd7932a3750a01045cd 100644 (file)
@@ -224,6 +224,7 @@ class ReviewsController < ApplicationController
     if !params[:comment_id].blank? && @violation.review
       @comment = @violation.review.comments.find(params[:comment_id])
     end
+    @user_options = options_for_users()
     render :partial => 'reviews/violation_comment_form'
   end
 
@@ -237,8 +238,9 @@ class ReviewsController < ApplicationController
     sanitize_violation(violation)
 
     unless violation.review
+      assignee = User.find params[:assignee_id]
       violation.create_review!(
-          :assignee => (params['assign_to_me']=='me' ? current_user : nil),
+          :assignee => assignee,
           :user => current_user)
     end
 
index fbdd66358662d319404d54f269d19483e8ef95fd..9d24f8286399708469a427b817d8a3341c05ab3b 100644 (file)
@@ -18,7 +18,8 @@
 
         <% if @violation.review.nil? || @violation.review.comments.size==0 %>
           &nbsp;
-          <%= check_box_tag "assign_to_me", "me", true -%> <label for="assign_to_me">Assign to me</label>
+          Assign to: 
+          <%= select_tag "assignee_id", options_for_select(@user_options, current_user.id.to_s)  %>
         <% end %>
       </td>
       <td class="sep"></td>