Skip to content

Filtering TODOs by Issue type includes tasks

Mario Celi requested to merge 378944-todo-filter-issue-include-work-item into master

What does this MR do and why?

Creates an an alias for the todo filter TYPE = Issue. Some TODOs are created as WorkItem todos if created from the task interface. But we still want these todos to show up when filtering by Issue since WorkItems and Issues are the same.

Related conversation in #375662 (comment 1118399420)

Screenshots or screen recordings

This is how filtering worked before this change

Screen_Recording_2022-12-13_at_17.44.22

How to set up and validate locally

  1. Create a task on an issue.
  2. Assign yourself to the created task
  3. Go to your TODO list and you should see the new TODO for the task.
  4. Before this change, selecting the TYPE filter Issue should hide the task todo. After this change, it should remain on the list.

DB review

From the DB explains we can see that we are in need of a specialized index for this filter, regardless of the change in this MR. If necessary we could consider creating that index as a follow up.

Filtering TODOs by target_type before the alias

https://console.postgres.ai/shared/21b37e92-e529-40b6-8a40-319ae8362c8f
SELECT 
  "todos".* 
FROM 
  "todos" 
WHERE 
  "todos"."user_id" = 8110537 
  AND (
    "todos"."state" IN ('done')
  ) 
  AND "todos"."target_type" = 'Issue' 
ORDER BY 
  "todos"."id" DESC 
LIMIT 
  20 OFFSET 0

Filtering TODOs by target_type with Issue alias

https://console.postgres.ai/shared/0129c64b-d0ff-45bf-b2f4-500e343d37fe
SELECT 
  "todos".* 
FROM 
  "todos" 
WHERE 
  "todos"."user_id" = 8110537 
  AND (
    "todos"."state" IN ('done')
  ) 
  AND "todos"."target_type" IN ('Issue', 'WorkItem') 
ORDER BY 
  "todos"."id" DESC 
LIMIT 
  20 OFFSET 0

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #378944 (closed)

Edited by Mario Celi

Merge request reports

Loading