]> source.dussan.org Git - redmine.git/commitdiff
Fixed: Error generated on 'search for watchers to add' after clicking add without...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 21 Mar 2014 00:23:46 +0000 (00:23 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 21 Mar 2014 00:23:46 +0000 (00:23 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12985 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/watchers_controller.rb
test/functional/watchers_controller_test.rb

index 0096d8ac1c603db9997c0da2e201214b963876a5..e6c4d3119addc325699983bfc76cc6c5a70a2980 100644 (file)
@@ -55,6 +55,9 @@ class WatchersController < ApplicationController
       user_ids = params[:watcher][:user_ids] || [params[:watcher][:user_id]]
       @users = User.active.where(:id => user_ids).all
     end
+    if @users.blank?
+      render :nothing => true
+    end
   end
 
   def destroy
index 8ec2aa112bb209d004092bbe34fc6116ad47c767..dc72a9b6bdb4a16424ccb308fe32f11a5b0dee0e 100644 (file)
@@ -237,6 +237,13 @@ class WatchersControllerTest < ActionController::TestCase
     end
   end
 
+  def test_append_without_user_should_render_nothing
+    @request.session[:user_id] = 2
+    xhr :post, :append, :project_id => 'ecookbook'
+    assert_response :success
+    assert response.body.blank?
+  end
+
   def test_remove_watcher
     @request.session[:user_id] = 2
     assert_difference('Watcher.count', -1) do