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_csv feature flag, instead relying on the work_items_project_issues_list FF to determine whether work item CSV import / export is enabled on the backend
    • At the time of writing this, the import_export_work_items_csv FF is only enabled on internal testing groups (issue-reproduce/work-items, issue-reproduce/requirements and issue-reproduce/matt-d-test-project), so switching to work_items_project_issues_list should only affect these internal groups
  • Defaults the work item type to issue when not provided for the work items CSV import. This allows compatibility with CSV exported using the existing issues CSV export
  • Passes perform_spam_check to 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 Locked column to match that of the issues export (Yes / No vs true / 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:

  1. In app/controllers/projects/issues_controller.rb, edit the import_csv method to call the work item service:
result = WorkItems::PrepareImportCsvService.new(project, current_user, file: params[:file]).execute
  1. 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
  2. Enable the work_items_project_issues_list FF
  3. 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)
  4. 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:
  1. ImportCsvService#email_results_to_user: Notify.import_work_items_csv_email(user.id, project.id, results).deliver_now
  2. 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

Merge request reports

Loading