Skip to content

Add IssuableFinder support for OR filtering of assignees

Heinrich Lee Yu requested to merge 296031-assignee-or-filters into master

What does this MR do?

This is similar to !54444 (merged) but for assignees. This allows OR filtering of assignees and refactors the assignee filter into a separate class.

Testing manually

  1. Enable the :or_issuable_queries feature flag.
  2. Visit http://localhost:3000/h5bp/html5-boilerplate/-/issues?or[assignee_username][]=user1&or[assignee_username][]=user2

Note: The filter bar won't show the filter tokens yet because this is backend only

Sample query

SELECT "issues".*
FROM "issues"
WHERE "issues"."project_id" = 2880930 
  AND ("issues"."state_id" IN (1))
  AND (EXISTS (
    SELECT "issue_assignees".*
    FROM "issue_assignees"
    WHERE "issue_assignees"."user_id" IN (
      SELECT "users"."id" FROM "users" WHERE (LOWER("users"."username") IN (LOWER('engwan'), LOWER('mcelicalderonG')))
    ) AND (issue_id = issues.id)
  ))
  AND "issues"."issue_type" IN (0, 1)
ORDER BY "issues"."created_at" DESC, "issues"."id" DESC
LIMIT 20 OFFSET 0
Time: 4.987 ms  
  - planning: 1.213 ms  
  - execution: 3.774 ms  
    - I/O read: 0.000 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 2052 (~16.00 MiB) from the buffer pool  
  - reads: 0 from the OS file cache, including disk I/O  
  - dirtied: 0  
  - writes: 0

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/4135/commands/14411

  • The AND version of this query has multiple EXISTS statements per given assignee while this one has a single one with a subquery for the multiple users.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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 #296031 (closed)

Edited by Heinrich Lee Yu

Merge request reports