]> source.dussan.org Git - redmine.git/commitdiff
Merge r22538 and r22539 from trunk to 5.0-stable (#39894).
authorMarius Balteanu <marius.balteanu@zitec.com>
Thu, 21 Dec 2023 07:02:53 +0000 (07:02 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Thu, 21 Dec 2023 07:02:53 +0000 (07:02 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22541 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 58c875b0c5a78f511afaf616410d3c7066c6703f..dbacb5c766bd841a21b30a4f0ac1264b99311fa4 100644 (file)
@@ -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
index 38d0039d75a4016f9a4e3fbb927631c82fd03d87..bc0b591ef0efcd1104879fb530b0b1050dd8725a 100644 (file)
@@ -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