Project

General

Profile

Patch #36503 ยป improve_issue_query_default.patch

Go MAEDA, 2022-01-23 08:23

View differences:

app/models/issue_query.rb
79 79

  
80 80
  def self.default(project: nil, user: User.current)
81 81
    query = nil
82
    if user&.logged?
83
      query = find_by_id user.pref.default_issue_query
82
    # per user default
83
    if user&.logged? && (query_id = user.pref.default_issue_query)
84
      query = find_by(id: query_id)
84 85
    end
86
    # per project default
85 87
    query ||= project&.default_issue_query
86
    query || find_by_id(Setting.default_issue_query)
88
    # global default
89
    if query.nil? && (query_id = Setting.default_issue_query).present?
90
      query = find_by(id: query_id)
91
    end
92
    query
87 93
  end
88 94

  
89 95
  def initialize(attributes=nil, *args)
    (1-1/1)