From 945e973014404c31b0c99caa0481d4ef3b979bba Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Thu, 19 May 2011 09:58:46 +0200 Subject: [PATCH] SONAR-2426 Allow to directly assign a violation to users --- .../main/webapp/WEB-INF/app/controllers/reviews_controller.rb | 4 +++- .../app/views/reviews/_violation_comment_form.html.erb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb index 2fe120b3e34..d4680a507d4 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb @@ -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 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_comment_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_comment_form.html.erb index fbdd6635866..9d24f828639 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_comment_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_comment_form.html.erb @@ -18,7 +18,8 @@ <% if @violation.review.nil? || @violation.review.comments.size==0 %>   - <%= check_box_tag "assign_to_me", "me", true -%> + Assign to: + <%= select_tag "assignee_id", options_for_select(@user_options, current_user.id.to_s) %> <% end %> -- 2.39.5