diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-07-28 12:52:11 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-07-28 13:08:02 +0400 |
commit | a6d0c26ddb5d215c387ae4b455ee4b242afe3554 (patch) | |
tree | e503fb1525def6fdb35099b04dedb9008e16f768 | |
parent | 704737f83a84ede82a98b9fc5df71ff065622fd5 (diff) | |
download | sonarqube-a6d0c26ddb5d215c387ae4b455ee4b242afe3554.tar.gz sonarqube-a6d0c26ddb5d215c387ae4b455ee4b242afe3554.zip |
SONAR-2540 Comments containing only spaces should not lead to error
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb | 24 |
1 files 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 } |