diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 12:09:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-23 12:09:42 +0300 |
commit | e4bf776a8829e5186a0f63603c0be627b891d80e (patch) | |
tree | 537fe714bd336bfee9f30b101a5072950a04a62a /app/services | |
parent | 1635eacd2a9293cd04d21e82def6e2c14ed01242 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/labels/promote_service.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/app/services/labels/promote_service.rb b/app/services/labels/promote_service.rb index e73e6476c12..cc91fd4b4d2 100644 --- a/app/services/labels/promote_service.rb +++ b/app/services/labels/promote_service.rb @@ -13,13 +13,8 @@ module Labels new_label = clone_label_to_group_label(label) label_ids_for_merge(new_label).find_in_batches(batch_size: BATCH_SIZE) do |batched_ids| - update_issuables(new_label, batched_ids) - update_resource_label_events(new_label, batched_ids) - update_issue_board_lists(new_label, batched_ids) - update_priorities(new_label, batched_ids) - subscribe_users(new_label, batched_ids) - # Order is important, project labels need to be last - update_project_labels(batched_ids) + update_old_label_relations(new_label, batched_ids) + destroy_project_labels(batched_ids) end # We skipped validations during creation. Let's run them now, after deleting conflicting labels @@ -32,6 +27,14 @@ module Labels private + def update_old_label_relations(new_label, old_label_ids) + update_issuables(new_label, old_label_ids) + update_resource_label_events(new_label, old_label_ids) + update_issue_board_lists(new_label, old_label_ids) + update_priorities(new_label, old_label_ids) + subscribe_users(new_label, old_label_ids) + end + # rubocop: disable CodeReuse/ActiveRecord def subscribe_users(new_label, label_ids) # users can be subscribed to multiple labels that will be merged into the group one @@ -86,7 +89,7 @@ module Labels # rubocop: enable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord - def update_project_labels(label_ids) + def destroy_project_labels(label_ids) Label.where(id: label_ids).destroy_all # rubocop: disable DestroyAll end # rubocop: enable CodeReuse/ActiveRecord @@ -105,3 +108,5 @@ module Labels end end end + +Labels::PromoteService.prepend_if_ee('EE::Labels::PromoteService') |