Add reassignment error to Import::SourceUser
What does this MR do and why?
Add reassignment error to Import::SourceUser
This MR adds an error column to import source user records. This can be used to track why a particular reassignment failed, which can then be displayed in the front-end as per the below issue.
Issue: #473975 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Enable the
:importer_user_mapping
feature flag. - Generate test data:
user = User.first flight = Group.find_by(path: 'flightjs') # Template source user template = Import::SourceUser.new( placeholder_user: user, reassign_to_user: user, status: 1, source_hostname: "example.com", import_type: "github", reassigned_by_user: user ) # Create 10 source users on the toolbox group. 1.upto(10) do |num| new = template.dup new.namespace = flightjs new.source_username = "flight#{num}", new.source_name = "Flight User #{num}", new.source_user_identifier = "flu#{num}", new.save! end # Give some of them error messages flight.import_source_users.sample(5).each do |isu| isu.update(reassignment_error: SecureRandom.hex) end
- Run the query in GraphiQL and check the response:
{ group(fullPath: "flightjs") { importSourceUsers { nodes { id reassignmentError } } } }
Edited by James Nutt