Skip to content

Adds OR filtering by author for epics

Jan Provaznik requested to merge jp-or-author into master

What does this MR do and why?

Allows using OR filtering on epic's authors. This is similar to previously added OR filtering by labels (!110643 (merged))

Related to #382969 (closed)

DB queries

SELECT "epics".*
FROM "epics"
WHERE "epics"."group_id" IN
    (SELECT "namespaces"."id"
     FROM "namespaces"
     WHERE "namespaces"."type" = 'Group'
       AND (traversal_ids @> ('{9970}')))
  AND "epics"."author_id" IN
    (SELECT "users"."id"
     FROM "users"
     WHERE (LOWER("users"."username") IN (LOWER('jprovaznik'),
                                          LOWER('janp'))))
ORDER BY "epics"."id" DESC
LIMIT 101
SELECT "epics".*
FROM "epics"
LEFT OUTER JOIN "boards_epic_board_positions" ON "epics"."id" = "boards_epic_board_positions"."epic_id"
AND "boards_epic_board_positions"."epic_board_id" = 1
WHERE "epics"."group_id" IN
    (SELECT "namespaces"."id"
     FROM "namespaces"
     WHERE "namespaces"."type" = 'Group'
       AND (traversal_ids @> ('{9970}')))
  AND "epics"."author_id" IN
    (SELECT "users"."id"
     FROM "users"
     WHERE (LOWER("users"."username") IN (LOWER('jprovaznik'),
                                          LOWER('janp'))))
  AND "epics"."state_id" = 1
  AND (EXISTS
         (SELECT "label_links".*
          FROM "label_links"
          WHERE "label_links"."target_type" = 'Epic'
            AND ("epics"."id" = "label_links"."target_id")
            AND "label_links"."label_id" = 43
          LIMIT 1))
ORDER BY "boards_epic_board_positions"."relative_position" ASC NULLS LAST,
                                                               epics.id DESC
LIMIT 100
OFFSET 0

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Enable the invite modal
    Feature.enable(:or_issuable_queries)
  2. Sample query:
  • For epic listing:
query {
  group(fullPath: "flightjs") {
    id
    epics(or: {authorUsername: ["valerie", "trina"]}) {
      nodes { 
        id
        author {
          username
        }
      }
    }
  }
}
  • For epic boards:
query {
  group(fullPath: "flightjs") {
    id
    epicBoards {
      nodes {
        id
        lists {
          nodes {
            id
            epics(filters: {or: {authorUsername: ["valerie", "trina"]}}) {
              nodes {
                id
                author {
                  username
                }
              }
            }
          }
        }
      }
    }
  }
}

MR acceptance checklist

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

Edited by Jan Provaznik

Merge request reports

Loading