diff options
author | Go MAEDA <maeda@farend.jp> | 2024-06-04 09:37:34 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-06-04 09:37:34 +0000 |
commit | c19176a5c48e33e6bcfe280736092154deb58181 (patch) | |
tree | 0709a9c64a3cd88adab50d23f38d34d7ab9409c3 | |
parent | 70903787566df1f1e3ded8f82abd48b29a01f6ca (diff) | |
download | redmine-c19176a5c48e33e6bcfe280736092154deb58181.tar.gz redmine-c19176a5c48e33e6bcfe280736092154deb58181.zip |
Reduce an extra SQL query in IssuesController#retrieve_default_query (#40775).
Patch by Go MAEDA (@maeda).
git-svn-id: https://svn.redmine.org/redmine/trunk@22854 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/issues_controller.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 76e7ed921..8528a2fca 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -502,8 +502,9 @@ class IssuesController < ApplicationController return end if !params[:set_filter] && use_session && session[:issue_query] + # Don't apply the default query if a valid query id is set in the session query_id, project_id = session[:issue_query].values_at(:id, :project_id) - return if IssueQuery.where(id: query_id).exists? && project_id == @project&.id + return if query_id && project_id == @project&.id && IssueQuery.exists?(id: query_id) end if default_query = IssueQuery.default(project: @project) params[:query_id] = default_query.id |