From a6d0c26ddb5d215c387ae4b455ee4b242afe3554 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Thu, 28 Jul 2011 12:52:11 +0400 Subject: SONAR-2540 Comments containing only spaces should not lead to error --- .../WEB-INF/app/controllers/reviews_controller.rb | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 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 46bcf2a83ab..c8be6bd2837 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 @@ -95,12 +95,14 @@ class ReviewsController < ApplicationController return end - if params[:comment_id] - @review.edit_comment(current_user, params[:comment_id].to_i, params[:text]) - else - @review.create_comment(:user => current_user, :text => params[:text]) + unless params[:text].blank? + if params[:comment_id] + @review.edit_comment(current_user, params[:comment_id].to_i, params[:text]) + else + @review.create_comment(:user => current_user, :text => params[:text]) + end end - + render :partial => "reviews/view" end @@ -120,7 +122,7 @@ class ReviewsController < ApplicationController unless params[:comment].blank? @review.set_false_positive(params[:false_positive]=='true', :user => current_user, :text => params[:comment]) end - + render :partial => "reviews/view" end @@ -242,10 +244,12 @@ class ReviewsController < ApplicationController :user => current_user) end - if params[:comment_id] - violation.review.edit_comment(current_user, params[:comment_id].to_i, params[:text]) - else - violation.review.create_comment(:user => current_user, :text => params[:text]) + unless params[:text].blank? + if params[:comment_id] + violation.review.edit_comment(current_user, params[:comment_id].to_i, params[:text]) + else + violation.review.create_comment(:user => current_user, :text => params[:text]) + end end render :partial => "resource/violation", :locals => { :violation => violation } -- cgit v1.2.3