]> source.dussan.org Git - redmine.git/commitdiff
Merged r17949 to 4.0-stable (#29055).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 15 Mar 2019 07:29:10 +0000 (07:29 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 15 Mar 2019 07:29:10 +0000 (07:29 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.0-stable@17950 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/search_controller.rb
test/integration/api_test/search_test.rb

index 744c3a3cb9c664216b21a7123d4f495f6cc7e8c7..e192b855b1006b8eae42e6f7be14547ff6e98a6d 100644 (file)
@@ -37,7 +37,7 @@ class SearchController < ApplicationController
     end
 
     # quick jump to an issue
-    if (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i))
+    if !api_request? && (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i))
       redirect_to issue_path(issue)
       return
     end
index 2c14ed4ac1b9756318183045b8d689ddd193cd31..354f5f27b7bc063bc894694b1acd21e1abf68691 100644 (file)
@@ -89,4 +89,9 @@ class Redmine::ApiTest::SearchTest < Redmine::ApiTest::Base
     assert_equal 4, json['limit']
     assert_equal issue[8..10], json['results'].map {|r| r['id']}
   end
+  test "GET /search.xml should not quick jump to the issue with given id" do
+    get '/search.xml', :params => {:q => '3'}
+    assert_response :success
+  end
 end