summaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2021-08-05 23:41:01 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2021-08-05 23:41:01 +0000
commit7e2f3352dbebb799fef78fe9c7c58cc367e20a88 (patch)
tree7ec0c9ce72ccb35e7a7780c7244d08318d81db0f /app/controllers/application_controller.rb
parent764228370c71a78665f8bc5727820dfbc6352e4a (diff)
downloadredmine-7e2f3352dbebb799fef78fe9c7c58cc367e20a88.tar.gz
redmine-7e2f3352dbebb799fef78fe9c7c58cc367e20a88.zip
Fix that updating an issue from context menu to a none value do not set the field to blank (#33521).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@21139 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f907b1159..f671d87f7 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -413,10 +413,18 @@ class ApplicationController < ActionController::Base
def parse_params_for_bulk_update(params)
attributes = (params || {}).reject {|k, v| v.blank?}
- attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
if custom = attributes[:custom_field_values]
custom.reject! {|k, v| v.blank?}
- custom.keys.each do |k|
+ end
+
+ replace_none_values_with_blank(attributes)
+ end
+
+ def replace_none_values_with_blank(params)
+ attributes = (params || {}))
+ attributes.each_key {|k| attributes[k] = '' if attributes[k] == 'none'}
+ if (custom = attributes[:custom_field_values])
+ custom.each_key do |k|
if custom[k].is_a?(Array)
custom[k] << '' if custom[k].delete('__none__')
else