Project

General

Profile

Patch #26104 ยป 0001-Quick-jump-to-issue-only-if-searching-for-issues.patch

Holger Just, 2017-06-06 15:31

View differences:

app/controllers/search_controller.rb
36 36
      @limit = 10 if @limit == 0
37 37
    end
38 38

  
39
    # quick jump to an issue
40
    if (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i))
41
      redirect_to issue_path(issue)
42
      return
43
    end
44

  
45 39
    projects_to_search =
46 40
      case params[:scope]
47 41
      when 'all'
......
65 59
    @scope = @object_types.select {|t| params[t]}
66 60
    @scope = @object_types if @scope.empty?
67 61

  
62
    # quick jump to an issue
63
    if @scope.include?('issues') && (m = @question.match(/^#?(\d+)$/)) && (issue = Issue.visible.find_by_id(m[1].to_i))
64
      redirect_to issue_path(issue)
65
      return
66
    end
67

  
68 68
    fetcher = Redmine::Search::Fetcher.new(
69 69
      @question, User.current, @scope, projects_to_search,
70 70
      :all_words => @all_words, :titles_only => @titles_only, :attachments => @search_attachments, :open_issues => @open_issues,
    (1-1/1)