diff options
Diffstat (limited to 'app/services/issuable')
-rw-r--r-- | app/services/issuable/bulk_update_service.rb | 13 | ||||
-rw-r--r-- | app/services/issuable/clone/attributes_rewriter.rb | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/app/services/issuable/bulk_update_service.rb b/app/services/issuable/bulk_update_service.rb index 2cd0e1e992d..2902385da4a 100644 --- a/app/services/issuable/bulk_update_service.rb +++ b/app/services/issuable/bulk_update_service.rb @@ -17,9 +17,8 @@ module Issuable ids = params.delete(:issuable_ids).split(",") items = find_issuables(parent, model_class, ids) - permitted_attrs(type).each do |key| - params.delete(key) unless params[key].present? - end + params.slice!(*permitted_attrs(type)) + params.delete_if { |k, v| v.blank? } if params[:assignee_ids] == [IssuableFinder::Params::NONE.to_s] params[:assignee_ids] = [] @@ -40,9 +39,13 @@ module Issuable private def permitted_attrs(type) - attrs = %i(state_event milestone_id assignee_id assignee_ids add_label_ids remove_label_ids subscription_event) + attrs = %i(state_event milestone_id add_label_ids remove_label_ids subscription_event) + + issuable_specific_attrs(type, attrs) + end - if type == 'issue' + def issuable_specific_attrs(type, attrs) + if type == 'issue' || type == 'merge_request' attrs.push(:assignee_ids) else attrs.push(:assignee_id) diff --git a/app/services/issuable/clone/attributes_rewriter.rb b/app/services/issuable/clone/attributes_rewriter.rb index a78e191c85f..b185ab592ff 100644 --- a/app/services/issuable/clone/attributes_rewriter.rb +++ b/app/services/issuable/clone/attributes_rewriter.rb @@ -105,7 +105,7 @@ module Issuable yield(event) end.compact - Gitlab::Database.bulk_insert(table_name, events) + Gitlab::Database.bulk_insert(table_name, events) # rubocop:disable Gitlab/BulkInsert end end |