diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-05-28 18:29:24 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-05-28 18:29:24 +0000 |
commit | 9fb1c60ef2af523d8291da233fe909cb2fa50201 (patch) | |
tree | 5377c12f5c51d13fcd1bbbaae26ec3be27d43f1f /app/models | |
parent | 78036b902cbac637edd348ce0ee58bcd564255fd (diff) | |
download | redmine-9fb1c60ef2af523d8291da233fe909cb2fa50201.tar.gz redmine-9fb1c60ef2af523d8291da233fe909cb2fa50201.zip |
Merged r21614 to 5.0-stable (#37135).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21622 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project_query.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/project_query.rb b/app/models/project_query.rb index 002437aeb..8c6643c7b 100644 --- a/app/models/project_query.rb +++ b/app/models/project_query.rb @@ -39,10 +39,13 @@ class ProjectQuery < Query def self.default(project: nil, user: User.current) query = nil - if user&.logged? - query = find_by_id user.pref.default_project_query + if user&.logged? && (query_id = user.pref.default_project_query).present? + query = find_by(id: query_id) end - query || find_by_id(Setting.default_project_query) + if query.nil? && (query_id = Setting.default_project_query).present? + query = find_by(id: query_id) + end + query end def initialize(attributes=nil, *args) |