From 61556b87ed2946168921935ddcc453a4c05ac3ce Mon Sep 17 00:00:00 2001 From: Holger Just Date: Thu, 1 Jun 2017 15:36:01 +0200 Subject: [PATCH] Quick jump to issue only if searching for issues Previously, we would always jump to the issue if a user searches for a number which exists as an issue ID. That made it impossible to search for e.g. (phone) numbers in wiki pages. With this patch, we are only jumping to the matching issue if we are searching for issues. This results in a behavior change for the quick search box in the the wiki. Previously, we would also jump to an issue there. Now, we just search in the wiki for the number. --- app/controllers/search_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 4b35cd8b4..30c3a4834 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -36,12 +36,6 @@ class SearchController < ApplicationController @limit = 10 if @limit == 0 end - # quick jump to an issue - if (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i)) - redirect_to issue_path(issue) - return - end - projects_to_search = case params[:scope] when 'all' @@ -65,6 +59,12 @@ class SearchController < ApplicationController @scope = @object_types.select {|t| params[t]} @scope = @object_types if @scope.empty? + # quick jump to an issue + if @scope.include?('issues') && (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i)) + redirect_to issue_path(issue) + return + end + fetcher = Redmine::Search::Fetcher.new( @question, User.current, @scope, projects_to_search, :all_words => @all_words, :titles_only => @titles_only, :attachments => @search_attachments, :open_issues => @open_issues, -- 2.13.0