diff options
author | Sean McGivern <sean@gitlab.com> | 2019-04-05 13:28:19 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-04-05 13:28:19 +0300 |
commit | 934dabaf6da42db7197e07dc95cf88d34e847306 (patch) | |
tree | 537ca94aeaf22d8ddb411582b3f66c0cd9c6fad2 /app/services | |
parent | 39eb16aab2dbac3347f61f83fb60f5448d44e965 (diff) | |
parent | ea3831986b63b2e070d9b61c8e307488822acf28 (diff) |
Merge branch 'keyval-labels' into 'master'
[CE] Add mutually exclusive labels
See merge request gitlab-org/gitlab-ce!26804
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/issuable_base_service.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 04dfcfbc22d..7a4ccf0d178 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -107,12 +107,13 @@ class IssuableBaseService < BaseService @labels_service ||= ::Labels::AvailableLabelsService.new(current_user, parent, params) end - def process_label_ids(attributes, existing_label_ids: nil) + def process_label_ids(attributes, existing_label_ids: nil, extra_label_ids: []) label_ids = attributes.delete(:label_ids) add_label_ids = attributes.delete(:add_label_ids) remove_label_ids = attributes.delete(:remove_label_ids) new_label_ids = existing_label_ids || label_ids || [] + new_label_ids |= extra_label_ids if add_label_ids.blank? && remove_label_ids.blank? new_label_ids = label_ids if label_ids @@ -147,7 +148,7 @@ class IssuableBaseService < BaseService params.delete(:state_event) params[:author] ||= current_user - params[:label_ids] = issuable.label_ids.to_a + process_label_ids(params) + params[:label_ids] = process_label_ids(params, extra_label_ids: issuable.label_ids.to_a) issuable.assign_attributes(params) |