diff options
author | Go MAEDA <maeda@farend.jp> | 2022-08-02 08:09:50 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2022-08-02 08:09:50 +0000 |
commit | dd1e8c6c39c6cc109694d8609a8318e51becefc6 (patch) | |
tree | 10a6b945f2f96d566a6343b3976b6a1e2703db55 /app | |
parent | 117553bb4902a1123a94214e9021884cfbf4e555 (diff) | |
download | redmine-dd1e8c6c39c6cc109694d8609a8318e51becefc6.tar.gz redmine-dd1e8c6c39c6cc109694d8609a8318e51becefc6.zip |
Merged r21748 from trunk to 5.0-stable (#37499).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21753 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/issue_query.rb | 12 | ||||
-rw-r--r-- | app/models/project_query.rb | 7 |
2 files changed, 12 insertions, 7 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 45ffcb57c..aa8dc9034 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -78,18 +78,22 @@ class IssueQuery < Query scope :for_all_projects, ->{ where(project_id: nil) } def self.default(project: nil, user: User.current) - query = nil # user default if user&.logged? && (query_id = user.pref.default_issue_query).present? query = find_by(id: query_id) + return query if query&.visible? end + # project default - query ||= project&.default_issue_query + query = project&.default_issue_query + return query if query&.visibility == VISIBILITY_PUBLIC + # global default - if query.nil? && (query_id = Setting.default_issue_query).present? + if (query_id = Setting.default_issue_query).present? query = find_by(id: query_id) + return query if query&.visibility == VISIBILITY_PUBLIC end - query + nil end def initialize(attributes=nil, *args) diff --git a/app/models/project_query.rb b/app/models/project_query.rb index 8c6643c7b..acb518f34 100644 --- a/app/models/project_query.rb +++ b/app/models/project_query.rb @@ -38,14 +38,15 @@ class ProjectQuery < Query ] def self.default(project: nil, user: User.current) - query = nil if user&.logged? && (query_id = user.pref.default_project_query).present? query = find_by(id: query_id) + return query if query&.visible? end - if query.nil? && (query_id = Setting.default_project_query).present? + if (query_id = Setting.default_project_query).present? query = find_by(id: query_id) + return query if query&.visibility == VISIBILITY_PUBLIC end - query + nil end def initialize(attributes=nil, *args) |