Allow merge_request dashboard filter to load review requested MRs
requested to merge 237922-show-merge-requests-where-user-is-designated-as-reviewer-on-the-mr-list-page into master
What does this MR do?
This MR add review requested MRs to the existing Assignee filter. We may need to add dedicated Reviewer filter down the track, but this is a first iteration towards making Reviewer feature more useful.
There is frontend MR(!43565 (merged)) that displays reviewer icons just as we do for Assignee as well.
Related to #237922 (closed)
Database query change
This query output is captured after executing MergeRequestsFinder.new(User.first, assignee_username: 'root').execute
.
BEFORE:
SELECT "merge_requests".*
FROM "merge_requests"
INNER JOIN "projects" ON "projects"."id" = "merge_requests"."target_project_id"
LEFT JOIN project_features ON projects.id = project_features.project_id
WHERE (
EXISTS (
SELECT 1
FROM "project_authorizations"
WHERE "project_authorizations"."user_id" = 1
AND (project_authorizations.project_id = projects.id)
)
OR projects.visibility_level IN (0,10,20)
) AND (
"project_features"."merge_requests_access_level" > 0
OR "project_features"."merge_requests_access_level" IS NULL
) AND (
EXISTS (
SELECT true
FROM "merge_request_assignees"
WHERE "merge_request_assignees"."user_id" IN (1)
AND merge_request_id = merge_requests.id
)
)
ORDER BY "merge_requests"."id" DESC
- Plan (warm cache): https://explain.depesz.com/s/9wAF
AFTER
SELECT "merge_requests".*
FROM (
(
SELECT "merge_requests".*
FROM "merge_requests"
INNER JOIN "projects" ON "projects"."id" = "merge_requests"."target_project_id"
LEFT JOIN project_features ON projects.id = project_features.project_id
WHERE (
EXISTS (
SELECT 1
FROM "project_authorizations"
WHERE "project_authorizations"."user_id" = 1
AND (project_authorizations.project_id = projects.id)
)
OR projects.visibility_level IN (0,10,20)
) AND (
"project_features"."merge_requests_access_level" > 0
OR "project_features"."merge_requests_access_level" IS NULL
) AND (
EXISTS (
SELECT true
FROM "merge_request_assignees"
WHERE "merge_request_assignees"."user_id" IN (1)
AND merge_request_id = merge_requests.id
)
)
)
UNION
(
SELECT "merge_requests".*
FROM "merge_requests"
INNER JOIN "projects" ON "projects"."id" = "merge_requests"."target_project_id"
LEFT JOIN project_features ON projects.id = project_features.project_id
WHERE (
EXISTS (
SELECT 1
FROM "project_authorizations"
WHERE "project_authorizations"."user_id" = 1
AND ( project_authorizations.project_id = projects.id)
)
OR projects.visibility_level IN (0,10,20)
) AND (
"project_features"."merge_requests_access_level" > 0
OR "project_features"."merge_requests_access_level" IS NULL
) AND (
EXISTS (
SELECT TRUE
FROM merge_request_reviewers
WHERE user_id = 1 AND merge_request_id = merge_requests.id
)
)
)
) merge_requests ORDER BY "merge_requests"."id" DESC
- Plan (cold cache): https://explain.depesz.com/s/sUTD
- Plan (warm cache): https://explain.depesz.com/s/SEdH
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Related to #237922 (closed)
Edited by Toon Claes