summaryrefslogtreecommitdiffstats
path: root/app/models/project_query.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-07-31 13:33:27 +0000
committerGo MAEDA <maeda@farend.jp>2022-07-31 13:33:27 +0000
commit72e2efdc6070bc4aef66042b471a5b20c8daa43b (patch)
treea3d86d9cbf5b65e114858f9c9315ae4ce815281a /app/models/project_query.rb
parent6ee209843ed0720a861173680bc888a10f305b2e (diff)
downloadredmine-72e2efdc6070bc4aef66042b471a5b20c8daa43b.tar.gz
redmine-72e2efdc6070bc4aef66042b471a5b20c8daa43b.zip
Default query should not be applied if the query is not allowed to be set as the default (#37499).
Patch by Mizuki ISHIKAWA. git-svn-id: https://svn.redmine.org/redmine/trunk@21748 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/project_query.rb')
-rw-r--r--app/models/project_query.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/project_query.rb b/app/models/project_query.rb
index 57d0330d1..69d10aeb4 100644
--- a/app/models/project_query.rb
+++ b/app/models/project_query.rb
@@ -40,14 +40,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)