Skip to content

Allow negating terms in IssuableFinder

Mario de la Ossa requested to merge 64213-not_filtering into master

What does this MR do?

Adds a not param to the Issues API endpoint that allows users to negate searches using all the currently-available params (milestone, labels, etc). In order to allow this we add a not param to IssuableFinder that can be used in order to negate things. This allows for multiple NOTs, but is a bit dirty in its implementation. Follow-up issue for refactor: gitlab-foss#33356 (moved)

While currently there's ONLY support for Issues API, this will soon also support API endpoints for MergeRequests (gitlab-foss#66352 (moved) ) and Epics (#13680 ).

We'll also soon add frontend support, but since the functionality was added to `IssuableFinder` directly, manually writing the params will work (update: doesn't work anymore as strong params will filter them out).

For example going to http://localhost:3000/gitlab-org/gitlab-test/issues?scope=all&utf8=%E2%9C%93&state=opened&not[label_name][]=a will show all issues without the label a

http://localhost:3000/gitlab-org/gitlab-test/issues?scope=all&utf8=%E2%9C%93&state=opened&not[author_username]=user0 will show all issues for which user0 is not the author

Does this MR meet the acceptance criteria?

Conformity

Performance 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

Refs gitlab-foss#64213 (moved) and #18059 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports