summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/watchers_controller.rb7
-rw-r--r--test/functional/watchers_controller_test.rb6
2 files changed, 12 insertions, 1 deletions
diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb
index 58c875b0c..dbacb5c76 100644
--- a/app/controllers/watchers_controller.rb
+++ b/app/controllers/watchers_controller.rb
@@ -32,7 +32,12 @@ class WatchersController < ApplicationController
accept_api_auth :create, :destroy
def new
- @users = users_for_new_watcher
+ respond_to do |format|
+ format.html { render_404 }
+ format.js do
+ @users = users_for_new_watcher
+ end
+ end
end
def create
diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb
index 239a0418c..30662480d 100644
--- a/test/functional/watchers_controller_test.rb
+++ b/test/functional/watchers_controller_test.rb
@@ -156,6 +156,12 @@ class WatchersControllerTest < Redmine::ControllerTest
assert_match /ajax-modal/, response.body
end
+ def test_new_as_html_should_respond_with_404
+ @request.session[:user_id] = 2
+ get :new, :params => {:object_type => 'issue', :object_id => '2'}
+ assert_response 404
+ end
+
def test_new_for_message
@request.session[:user_id] = 2
get :new, :params => {:object_type => 'message', :object_id => '1'}, :xhr => true