Skip to content

Move all FF for archived search to user actors

Terri Chu requested to merge tchu-move-search-archived-ff-to-user-gates into master

What does this MR do and why?

Noticed during roll out of search_projects_hide_archived in #413821 (closed)

The backend feature flags are not gated to an actor. The frontend code (for projects) and eventually for the other flagged scopes sends a user actor.

This MR:

  • updates the flag check on the backend to add a current_user actor
  • fixes rubocop todos for lib/gitlab/search_results.rb (1 todo was not fixable easily so I left it)

Screenshots or screen recordings

N/A

How to set up and validate locally

FF_NAME SCOPE TAB BASIC GROUP SEARCH?
:search_commits_hide_archived_projects commits Commits
:search_merge_requests_hide_archived_projects merge_requests Merge Requests
:search_notes_hide_archived_projects notes Comments
:search_projects_hide_archived projects Projects

For each Feature Flag, verify using the steps below.

  1. Archive one project in a group (or use an existing archived project)
  2. Enable elasticsearch in gdk (if not already enabled)
    1. index everything using gitlab:elastic:index rake task
    2. enable search with advanced search
  3. Find a value to search for in the scope
  4. In rails console fully disable then enable FF_NAME for one user
    Feature.disable(:FF_NAME)
    Feature.enable(:FF_NAME, User.first)
  5. Search for SCOPE in that group example: http://gdk.test:3000/search?scope=SCOPE&search=aut&group_id=46
  6. Verify results are not returned from the archived project
  7. Search for SCOPE in that group, but first add &include_archived=true onto the end of the URL example: http://gdk.test:3000/search?scope=SCOPE&search=aut&group_id=46&include_archived=true
  8. Verify results are returned from the archived project
  9. Repeat the steps above for Basic Search if supported. To force basic search add &basic_search=true to the URL or disable Search with Advanced Search from the Admin Settings

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 Terri Chu

Merge request reports

Loading