diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /app/services/labels/transfer_service.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/services/labels/transfer_service.rb')
-rw-r--r-- | app/services/labels/transfer_service.rb | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/app/services/labels/transfer_service.rb b/app/services/labels/transfer_service.rb index 19d419609a5..67163cb8122 100644 --- a/app/services/labels/transfer_service.rb +++ b/app/services/labels/transfer_service.rb @@ -50,32 +50,17 @@ module Labels # rubocop: disable CodeReuse/ActiveRecord def group_labels_applied_to_issues - @labels_applied_to_issues ||= if use_optimized_group_labels_query? - Label.joins(:issues) - .joins("INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'" ) - .where(issues: { project_id: project.id }).reorder(nil) - else - Label.joins(:issues).where( - issues: { project_id: project.id }, - labels: { group_id: old_group.self_and_ancestors } - ) - end + @labels_applied_to_issues ||= Label.joins(:issues) + .joins("INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'" ) + .where(issues: { project_id: project.id }).reorder(nil) end # rubocop: enable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord def group_labels_applied_to_merge_requests - @labels_applied_to_mrs ||= if use_optimized_group_labels_query? - Label.joins(:merge_requests) - .joins("INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'" ) - .where(merge_requests: { target_project_id: project.id }).reorder(nil) - else - Label.joins(:merge_requests) - .where( - merge_requests: { target_project_id: project.id }, - labels: { group_id: old_group.self_and_ancestors } - ) - end + @labels_applied_to_mrs ||= Label.joins(:merge_requests) + .joins("INNER JOIN namespaces on namespaces.id = labels.group_id AND namespaces.type = 'Group'" ) + .where(merge_requests: { target_project_id: project.id }).reorder(nil) end # rubocop: enable CodeReuse/ActiveRecord @@ -99,9 +84,5 @@ module Labels .update_all(label_id: new_label_id) end # rubocop: enable CodeReuse/ActiveRecord - - def use_optimized_group_labels_query? - Feature.enabled?(:use_optimized_group_labels_query, project.root_namespace, default_enabled: :yaml) - end end end |