Don't check permission when creating project labels during transfer
What does this MR do and why?
Modified label transfer functionality: Updated the label transfer service to skip authorization checks when creating or finding labels during the transfer process. This change also reformatted the code to be more readable by splitting long method calls across multiple lines.
We already pass skip_authorization: true in various places where labels are created in an automated fashion (e.g. Project#create_labels, IncidentManagement::CreateIncidentSlaExceededLabelService#execute, Gitlab::IssuesLabels.generate, Gitlab::BitbucketImport::Importers::RepositoryImporter#create_labels, Gitlab::FogbugzImport::Importer#create_label) so it seems logical to also use it in Labels::TransferService#find_or_create_label!.
References
Related to Group transfer failure via API when group has a... (#554868 - closed).
How to set up and validate locally
- Create group
a - Create a group label
labelunder the top-level groupa - Create subgroup
a/aa - Create project
a/aa/aaa - Create an issue under project
a/aa/aaaand apply thelabelgroup label to it - Archive project
a/aa/aaa - Create group
b - Transfer subgroup
a/aato the groupb - Transfer should succeed and the issue under
b/aa/ashould have thelabellabel (b/aa/aproject label created during the transfer from theagroup)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.