Default to issue type for work items CSV import
What does this MR do and why?
This MR makes several small changes to bring the work items CSV import / export closer to parity with the issues CSV import / export
- Removes the
import_export_work_items_csvfeature flag, instead relying on thework_items_project_issues_listFF to determine whether work item CSV import / export is enabled on the backend- At the time of writing this, the
import_export_work_items_csvFF is only enabled on internal testing groups (issue-reproduce/work-items,issue-reproduce/requirementsandissue-reproduce/matt-d-test-project), so switching towork_items_project_issues_listshould only affect these internal groups
- At the time of writing this, the
- Defaults the work item type to
issuewhen not provided for the work items CSV import. This allows compatibility with CSV exported using the existing issues CSV export - Passes
perform_spam_checkto the work items finder, which is included in the issues import CSV service, but was missing from the work items service - Changes the formatting of the
Lockedcolumn to match that of the issues export (Yes/Novstrue/false)
References
Screenshots or screen recordings
Not provided
How to set up and validate locally
Since there's no way to currently call the mutation from the UI, we'll update the backend controller to call the WI equivalent API:
- In
app/controllers/projects/issues_controller.rb, edit theimport_csvmethod to call the work item service:
result = WorkItems::PrepareImportCsvService.new(project, current_user, file: params[:file]).execute
- Load the project issues page. Do this before setting the FF in step 3, so the UI still gives you option to import the CSV
- Enable the
work_items_project_issues_listFF - Attempt to import a CSV without without a type column (example: Example_1.csv). Alternatively, import a CSV where only certain rows have a type (example: Example_2.csv)
- Observe that the imported work items without a type are imported as issues
- Note that emails and the background import export jobs can take some time to complete. To speed this process up, I changed the following lines to perform these actions synchronously for testing:
-
ImportCsvService#email_results_to_user:
Notify.import_work_items_csv_email(user.id, project.id, results).deliver_now -
PrepareService#enqueue_import:
worker.new.perform(current_user.id, project.id, upload.id)
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.
Edited by Matt D'Angelo