Filtering TODOs by Issue type includes tasks
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
- Create a task on an issue.
- Assign yourself to the created task
- Go to your TODO list and you should see the new TODO for the task.
- Before this change, selecting the
TYPE
filterIssue
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.
target_type
before the alias
Filtering TODOs by 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
target_type
with Issue alias
Filtering TODOs by 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #378944 (closed)