Skip to content

Filter merge requests by author

Madelein van Niekerk requested to merge 462904-mr-search-by-author into master

What does this MR do and why?

Related to #462904 (closed)

Feature flag: search_mr_filter_author

This MR adds a the author filter to SearchService for merge requests.

The backend will accept author_username for = and not[author_username] for != searches.

The frontend is expected to only send one param, but the backend will allow both. If both are supplied an OR operation is done

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Search filter Screenshot
No filter Screenshot_2024-07-12_at_12.35.21
author_username=USERNAME Screenshot_2024-07-12_at_12.33.16
not[author_username]=USERNAME Screenshot_2024-07-12_at_12.33.29

How to set up and validate locally

  1. enable elasticsearch for gdk, and index everything using gitlab:elastic:index rake task
  2. pick a project
  3. create two merge requests with the same searchable text
  4. search for the text in the project
  • /search?group_id=29&project_id=39&repository_ref=main&scope=merge_requests&search=test
  1. verify all results come back
  2. add the author_username=USERNAME param to the URL
  • /search?group_id=29&project_id=39&repository_ref=main&scope=merge_requests&search=test&author_username=USERNAME
  1. verify only the result from that user comes back
  2. add the not[author_username]=USERNAME param to the original URL
  • /search?group_id=29&project_id=39&repository_ref=main&scope=merge_requests&search=test&not[author_username]=USERNAME
  1. verify the result from that user does not come back

NOTE: You can repeat the test for group and global search

Edited by Madelein van Niekerk

Merge request reports