Search modal shows "All GitLab" option for anonmyous users even when it's not allowed

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Modal should not show Search all GitLab as an option if user is logged out and global anonymous searches are disabled, this leads to a poor UX experience on search. Users are redirected to an error message that global searches are not allowed

Steps to reproduce

  1. load a private browsing session
  2. navigate to any gitlab project: https://gitlab.com/gitlab-org/gitlab
  3. click search or go to button
  4. type in text
  5. perform the search by clicking on "in all GitLab" option image
  6. validate results are not returned, you are redirected to login, and an error is shown image

What is the current bug behavior?

Anonymous users are shown an option to search which is not enabled

What is the expected correct behavior?

Anonymous users should only be shown search options which are allowed

Possible fixes

Edited by 🤖 GitLab Bot 🤖