diff options
author | Go MAEDA <maeda@farend.jp> | 2018-10-04 12:46:32 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-10-04 12:46:32 +0000 |
commit | 28c231473f98a4b184204dd53cbeee1e0d655853 (patch) | |
tree | aecf6718ddbcef587a0fad04baf755fb4627f748 /app | |
parent | f199fd54b7bf404aa9d75134a55b6b4275a75ef1 (diff) | |
download | redmine-28c231473f98a4b184204dd53cbeee1e0d655853.tar.gz redmine-28c231473f98a4b184204dd53cbeee1e0d655853.zip |
Custom queries are broken by updating with nil parameter values (#29701).
Patch by Mizuki ISHIKAWA.
git-svn-id: http://svn.redmine.org/redmine/trunk@17566 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/queries_controller.rb | 2 | ||||
-rw-r--r-- | app/models/issue_query.rb | 4 | ||||
-rw-r--r-- | app/models/query.rb | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index 647d322ed..784dec984 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -122,7 +122,7 @@ class QueriesController < ApplicationController @query.project = params[:query_is_for_all] ? nil : @project @query.build_from_params(params) @query.column_names = nil if params[:default_columns] - @query.sort_criteria = params[:query] && params[:query][:sort_criteria] + @query.sort_criteria = (params[:query] && params[:query][:sort_criteria]) || @query.sort_criteria @query.name = params[:query] && params[:query][:name] if User.current.allowed_to?(:manage_public_queries, @query.project) || User.current.admin? @query.visibility = (params[:query] && params[:query][:visibility]) || Query::VISIBILITY_PRIVATE diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index c342dc456..38946f75a 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -75,8 +75,8 @@ class IssueQuery < Query def build_from_params(params, defaults={}) super - self.draw_relations = params[:draw_relations] || (params[:query] && params[:query][:draw_relations]) - self.draw_progress_line = params[:draw_progress_line] || (params[:query] && params[:query][:draw_progress_line]) + self.draw_relations = params[:draw_relations] || (params[:query] && params[:query][:draw_relations]) || options[:draw_relations] + self.draw_progress_line = params[:draw_progress_line] || (params[:query] && params[:query][:draw_progress_line]) || options[:draw_progress_line] self end diff --git a/app/models/query.rb b/app/models/query.rb index 2c0f90161..8bb391e66 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -377,10 +377,10 @@ class Query < ActiveRecord::Base end query_params = params[:query] || defaults || {} - self.group_by = params[:group_by] || query_params[:group_by] - self.column_names = params[:c] || query_params[:column_names] - self.totalable_names = params[:t] || query_params[:totalable_names] - self.sort_criteria = params[:sort] || query_params[:sort_criteria] + self.group_by = params[:group_by] || query_params[:group_by] || self.group_by + self.column_names = params[:c] || query_params[:column_names] || self.column_names + self.totalable_names = params[:t] || query_params[:totalable_names] || self.totalable_names + self.sort_criteria = params[:sort] || query_params[:sort_criteria] || self.sort_criteria self end |