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

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

index 486029fc996fda268f56d3dca1626b0aaa279f72..ce9e21f1dbf27e250a921ab74cee9bd49ce92147 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