Skip to content

Add issue filters to board list count/weight

Jan Provaznik requested to merge list_issue_filters into master

What does this MR do?

Accepts issue filters for board lists. The reason is that issueCount and totalWeight values depend on any additional filters used on the board.

Sample query:

query {
  group(fullPath: "h5bp") {
    boards(first: 20) {
      nodes {
        id
        lists(issueFilters: {labelName: "foo"}) {
          nodes {
            id
            totalWeight
            issuesCount
          }
        }
      }
    }
  }
}

This solution is not perfect, because we pass issue filters twice (to the list and to issues if we fetch also list's issues). On the other side we expose issueCount and totalWeight already on lists level too 🤷.

The second option I was thinking about was exposing these counts as part of the list's issue connection, so the query would be:

        lists {
          nodes {
            id
            issues(issueFilters: {labelName: "foo"}) {
              count # we already expose this
              weight # newly added sum weight
              nodes {
                id
                ...
              }
          }
        }

We actually already expose count for issues (because it uses CountableConnection), we could extend it to add also weight - it could look like this: https://gitlab.com/-/snippets/2020982. Although this approach seems more elegant, there are couple of significant downsides with it:

  • we would do separate SQL queries to get counts and weights (currently we do single query)
  • because of our authorization approach, it would trigger additional SQL query to get issues itself (even if user requests only count/weight without getting list of issues - which is exactly our use-case), there is a workaround/hack for this (#250267 (comment 421233765)) - although our UI could use the workaround, there would be performance penalty in the default behavior (w/o using the hack)
  • extending the connection like this would expose weight for all issue connections - I'm not sure we want/need to do it at this point

So for the reasons above I picked a boring solution to just add filters on the list level.

Related to #250267 (closed)

Screenshots

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
Edited by Jan Provaznik

Merge request reports