Skip to content

Handle updates for work_items in advanced search

Summary

Work items are missing archived field in the index. These are for old work items that were not updated when the migration ran. The migration only ran on issues

Also work items are not updated in the index when changes occur. Work items model inherits from Issue model and uses the same table. However, changes to project (archived, permissions, etc) are not propagated to the work item association.

Note: Work items show up in search results and redirect appropriately when the result is clicked

What is the current bug behavior?

  1. create a work item
  2. archive the project
  3. check work item in index to see whether it got updated with project archived = true

Possible fixes

  • ee/app/models/ee/project.rb - add elastic_index_dependant_association for work items
  • recreate the ee/elastic/migrate/20230628094700_backfill_archived_on_issues.rb migration for work_items only
    • suggestion doing all work items (or we might have incorrect data in the index due to the association updates not happening)