From ee5ddae176bd560235967e0883bdf638a392c5d2 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Fri, 2 May 2025 22:02:16 +0530 Subject: [PATCH 01/21] Replace ff with admin setting Changelog: other --- app/controllers/search_controller.rb | 2 +- config/feature_flags/ops/allow_anonymous_searches.yml | 8 -------- doc/user/search/_index.md | 10 ++++++++-- .../application_settings/_elasticsearch_form.html.haml | 3 +++ locale/gitlab.pot | 3 +++ spec/controllers/search_controller_spec.rb | 8 ++++---- 6 files changed, 19 insertions(+), 15 deletions(-) delete mode 100644 config/feature_flags/ops/allow_anonymous_searches.yml diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index d4dc75a523d03f..65a8869cc0de14 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -145,7 +145,7 @@ def authenticate? return true end - return true if ::Feature.disabled?(:allow_anonymous_searches, type: :ops) + return true unless ::Gitlab::CurrentSettings.anonymous_searches_allowed? false end diff --git a/config/feature_flags/ops/allow_anonymous_searches.yml b/config/feature_flags/ops/allow_anonymous_searches.yml deleted file mode 100644 index 248beb7c39d531..00000000000000 --- a/config/feature_flags/ops/allow_anonymous_searches.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: allow_anonymous_searches -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/434218 -milestone: '16.7' -type: ops -group: group::global search -default_enabled: true diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index ab8efb825178fe..6f6dd43bb4b2f7 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -65,7 +65,8 @@ For more information, see [issue 477333](https://gitlab.com/gitlab-org/gitlab/-/ - Restricting global search to authenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41041) in GitLab 13.4 [with a flag](../../administration/feature_flags.md) named `block_anonymous_global_searches`. Disabled by default. - Enabling or disabling anonymous searches [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. -- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11 as a UI option, instead of the `block_anonymous_global_searches` flag. +- Enabling or disabling anonymous global searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11 as a UI option, instead of the `block_anonymous_global_searches` flag. +- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190080) in GitLab 18.0 as a UI option, instead of the `allow_anonymous_searches` flag. {{< /history >}} @@ -79,7 +80,12 @@ To restrict `/search` to authenticated users only, do one of the following: - [Restrict public visibility](../../administration/settings/visibility_and_access_controls.md#restrict-visibility-levels) of the project or group. -- Disable the [feature flag](../../administration/feature_flags.md) `allow_anonymous_searches`. +- Change the admin setting to restrict search for only authenticated users by doing the following steps: + 1. On the left sidebar, at the bottom, select **Admin**. + 1. Select **Settings > Search**. + 1. Expand **Advanced Search** + 1. Clear **Enable search for unauthenticated users**. + 1. Select **Save changes**. To restrict global search to authenticated users only: diff --git a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml index 69b065161eac65..e0041d3b86d28c 100644 --- a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml +++ b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml @@ -51,6 +51,9 @@ .form-group = f.gitlab_ui_checkbox_component :elasticsearch_requeue_workers, s_('AdminSettings|Requeue indexing workers'), help_text: s_('AdminSettings|Improve non-code indexing throughput by enqueuing Sidekiq jobs until all documents are processed.') + .form-group + = f.gitlab_ui_checkbox_component :anonymous_searches_allowed, s_('AdminSettings|Enable search for unauthenticated users') + .form-group = f.label :elasticsearch_url, 'URL', class: 'label-bold' = f.text_field :elasticsearch_url, value: @application_setting.elasticsearch_url.join(', '), class: 'form-control gl-form-input', placeholder: 'http://localhost:9200, http://localhost:9201', data: { testid: 'url-field' } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6a8ed0dcf96e30..d64c0300b825b8 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4559,6 +4559,9 @@ msgstr "" msgid "AdminSettings|Enable product analytics" msgstr "" +msgid "AdminSettings|Enable search for unauthenticated users" +msgstr "" + msgid "AdminSettings|Enable smartcn custom analyzer: Indexing" msgstr "" diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb index 713c18f263996b..9fbc9fba743a16 100644 --- a/spec/controllers/search_controller_spec.rb +++ b/spec/controllers/search_controller_spec.rb @@ -252,9 +252,9 @@ end end - context 'when allow_anonymous_searches is disabled' do + context 'when anonymous_searches_allowed is disabled' do before do - stub_feature_flags(allow_anonymous_searches: false) + stub_application_setting(anonymous_searches_allowed: false) end context 'for unauthenticated user' do @@ -754,7 +754,7 @@ def request describe 'redirecting' do using RSpec::Parameterized::TableSyntax - where(:restricted_visibility_levels, :allow_anonymous_searches, :block_anonymous_global_searches, :redirect) do + where(:restricted_visibility_levels, :anonymous_searches_allowed, :block_anonymous_global_searches, :redirect) do [Gitlab::VisibilityLevel::PUBLIC] | true | false | true [Gitlab::VisibilityLevel::PRIVATE] | true | false | false nil | true | false | false @@ -766,7 +766,7 @@ def request with_them do before do stub_application_setting(restricted_visibility_levels: restricted_visibility_levels) - stub_feature_flags(allow_anonymous_searches: allow_anonymous_searches) + stub_application_setting(anonymous_searches_allowed: anonymous_searches_allowed) stub_application_setting(global_search_block_anonymous_searches_enabled: block_anonymous_global_searches) end -- GitLab From 4582c8b3c1fd02f15dc203c37776eaa880da1f21 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Fri, 2 May 2025 22:12:13 +0530 Subject: [PATCH 02/21] Apply 1 suggestion(s) to 1 file(s) --- doc/user/search/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index 6f6dd43bb4b2f7..4c8f325953e342 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -66,7 +66,7 @@ For more information, see [issue 477333](https://gitlab.com/gitlab-org/gitlab/-/ - Restricting global search to authenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41041) in GitLab 13.4 [with a flag](../../administration/feature_flags.md) named `block_anonymous_global_searches`. Disabled by default. - Enabling or disabling anonymous searches [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. - Enabling or disabling anonymous global searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11 as a UI option, instead of the `block_anonymous_global_searches` flag. -- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190080) in GitLab 18.0 as a UI option, instead of the `allow_anonymous_searches` flag. +- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0 as a UI option, instead of the `allow_anonymous_searches` flag. {{< /history >}} -- GitLab From fd6ceac972d4fe4fa7bbb4aee854b72f0167498b Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Sat, 3 May 2025 09:46:09 +0530 Subject: [PATCH 03/21] Add changes for Settings --- app/helpers/application_settings_helper.rb | 7 +++++++ .../_global_search_settings.html.haml | 4 ++-- .../_elasticsearch_form.html.haml | 3 --- locale/gitlab.pot | 18 +++++++++--------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index f516480ce38ebc..2546b973baa8d7 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -74,6 +74,13 @@ def enabled_protocol_button(container, protocol) def global_search_settings_checkboxes(form) [ + form.gitlab_ui_checkbox_component( + :anonymous_searches_allowed, + _("Enable search for unauthenticated users"), + checkbox_options: { + checked: @application_setting.anonymous_searches_allowed, multiple: false + } + ), form.gitlab_ui_checkbox_component( :global_search_block_anonymous_searches_enabled, _("Restrict global search to authenticated users"), diff --git a/app/views/admin/application_settings/_global_search_settings.html.haml b/app/views/admin/application_settings/_global_search_settings.html.haml index 84986941cb9d55..1f20ddc7eb586b 100644 --- a/app/views/admin/application_settings/_global_search_settings.html.haml +++ b/app/views/admin/application_settings/_global_search_settings.html.haml @@ -1,9 +1,9 @@ -= render ::Layouts::SettingsBlockComponent.new(_('Global Search'), += render ::Layouts::SettingsBlockComponent.new(_('Visibility & access controls'), id: 'js-global-search-settings', testid: 'admin-global-search-settings', expanded: expanded_by_default?) do |c| - c.with_description do - = _('Configure settings for global search.') + = _('Set visibility of search scopes and configure anonymous access.') = link_to _('Learn more.'), help_page_path('user/search/_index.md', anchor: 'disable-global-search-scopes'), target: '_blank', rel: 'noopener noreferrer' - c.with_body do = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-global-search-settings'), html: { class: 'fieldset-form', id: 'global-search-settings' } do |f| diff --git a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml index e0041d3b86d28c..69b065161eac65 100644 --- a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml +++ b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml @@ -51,9 +51,6 @@ .form-group = f.gitlab_ui_checkbox_component :elasticsearch_requeue_workers, s_('AdminSettings|Requeue indexing workers'), help_text: s_('AdminSettings|Improve non-code indexing throughput by enqueuing Sidekiq jobs until all documents are processed.') - .form-group - = f.gitlab_ui_checkbox_component :anonymous_searches_allowed, s_('AdminSettings|Enable search for unauthenticated users') - .form-group = f.label :elasticsearch_url, 'URL', class: 'label-bold' = f.text_field :elasticsearch_url, value: @application_setting.elasticsearch_url.join(', '), class: 'form-control gl-form-input', placeholder: 'http://localhost:9200, http://localhost:9201', data: { testid: 'url-field' } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index d64c0300b825b8..999233269db3b1 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4559,9 +4559,6 @@ msgstr "" msgid "AdminSettings|Enable product analytics" msgstr "" -msgid "AdminSettings|Enable search for unauthenticated users" -msgstr "" - msgid "AdminSettings|Enable smartcn custom analyzer: Indexing" msgstr "" @@ -16704,9 +16701,6 @@ msgstr "" msgid "Configure settings for exact code search." msgstr "" -msgid "Configure settings for global search." -msgstr "" - msgid "Configure specific limits for Files API requests that supersede the general user and IP rate limits." msgstr "" @@ -23895,6 +23889,9 @@ msgstr "" msgid "Enable repository checks" msgstr "" +msgid "Enable search for unauthenticated users" +msgstr "" + msgid "Enable searching" msgstr "" @@ -28328,9 +28325,6 @@ msgstr "" msgid "Global SAML group membership lock" msgstr "" -msgid "Global Search" -msgstr "" - msgid "Global Search is disabled for this scope" msgstr "" @@ -57012,6 +57006,9 @@ msgstr "" msgid "Set variables on protected branches and tags only." msgstr "" +msgid "Set visibility of search scopes and configure anonymous access." +msgstr "" + msgid "Set weight" msgstr "" @@ -66599,6 +66596,9 @@ msgstr "" msgid "Visibility" msgstr "" +msgid "Visibility & access controls" +msgstr "" + msgid "Visibility and access controls" msgstr "" -- GitLab From 845471ac5c9d58504f006cfd974a10a1348b671c Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Sat, 3 May 2025 09:48:07 +0530 Subject: [PATCH 04/21] Update docs based on rename --- doc/user/search/_index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index 6f6dd43bb4b2f7..a5ed7932afe816 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -91,7 +91,7 @@ To restrict global search to authenticated users only: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -1. Expand **Global search** +1. Expand **Visibility & access controls** 1. Select **Restrict global search to authenticated users**. 1. Select **Save changes**. @@ -122,7 +122,7 @@ To disable one or more global search scopes: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -1. Expand **Global search**. +1. Expand **Visibility & access controls**. 1. Clear the checkboxes for the scopes you want to disable. 1. Select **Save changes**. -- GitLab From 9914b52f857d2b51327efbed5c24eaf90ec02f26 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Sat, 3 May 2025 10:37:10 +0530 Subject: [PATCH 05/21] Fix failing spec --- .../ee/application_settings_helper_spec.rb | 19 ++++++++++--------- .../application_settings_helper_spec.rb | 11 ++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ee/spec/helpers/ee/application_settings_helper_spec.rb b/ee/spec/helpers/ee/application_settings_helper_spec.rb index 1ce11724401089..c55a25c09f1f14 100644 --- a/ee/spec/helpers/ee/application_settings_helper_spec.rb +++ b/ee/spec/helpers/ee/application_settings_helper_spec.rb @@ -260,15 +260,16 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).not_to have_checked_field('Restrict global search to authenticated users', with: 1) - expect(result[1]).to have_checked_field('Show issues in global search results', with: 1) - expect(result[2]).not_to have_checked_field('Show merge requests in global search results', with: 1) - expect(result[3]).to have_checked_field('Show snippets in global search results', with: 1) - expect(result[4]).not_to have_checked_field('Show users in global search results', with: 1) - expect(result[5]).to have_checked_field('Show code in global search results', with: 1) - expect(result[6]).not_to have_checked_field('Show commits in global search results', with: 1) - expect(result[7]).to have_checked_field('Show epics in global search results', with: 1) - expect(result[8]).to have_checked_field('Show wiki in global search results', with: 1) + expect(result[0]).to have_checked_field('Enable search for unauthenticated users', with: 1) + expect(result[1]).not_to have_checked_field('Restrict global search to authenticated users', with: 1) + expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) + expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) + expect(result[4]).to have_checked_field('Show snippets in global search results', with: 1) + expect(result[5]).not_to have_checked_field('Show users in global search results', with: 1) + expect(result[6]).to have_checked_field('Show code in global search results', with: 1) + expect(result[7]).not_to have_checked_field('Show commits in global search results', with: 1) + expect(result[8]).to have_checked_field('Show epics in global search results', with: 1) + expect(result[9]).to have_checked_field('Show wiki in global search results', with: 1) end end end diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb index 4c59e8a688153b..6cc379f200656e 100644 --- a/spec/helpers/application_settings_helper_spec.rb +++ b/spec/helpers/application_settings_helper_spec.rb @@ -402,11 +402,12 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).to have_checked_field('Restrict global search to authenticated users', with: 1) - expect(result[1]).to have_checked_field('Show issues in global search results', with: 1) - expect(result[2]).not_to have_checked_field('Show merge requests in global search results', with: 1) - expect(result[3]).to have_checked_field('Show snippets in global search results', with: 1) - expect(result[4]).not_to have_checked_field('Show users in global search results', with: 1) + expect(result[0]).to have_checked_field('Enable search for unauthenticated users', with: 1) + expect(result[1]).to have_checked_field('Restrict global search to authenticated users', with: 1) + expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) + expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) + expect(result[4]).to have_checked_field('Show snippets in global search results', with: 1) + expect(result[5]).not_to have_checked_field('Show users in global search results', with: 1) end end end -- GitLab From fbd88e1c1bd176055febb4172eb3369c05e86dd9 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 13:14:42 +0530 Subject: [PATCH 06/21] Apply 12 suggestion(s) to 5 file(s) Co-authored-by: Ashraf Khamis --- app/helpers/application_settings_helper.rb | 2 +- .../_global_search_settings.html.haml | 2 +- doc/user/search/_index.md | 21 ++++++++++--------- .../ee/application_settings_helper_spec.rb | 4 ++-- .../application_settings_helper_spec.rb | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 2546b973baa8d7..a87a9772c3af90 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -76,7 +76,7 @@ def global_search_settings_checkboxes(form) [ form.gitlab_ui_checkbox_component( :anonymous_searches_allowed, - _("Enable search for unauthenticated users"), + _("Allow search for unauthenticated users"), checkbox_options: { checked: @application_setting.anonymous_searches_allowed, multiple: false } diff --git a/app/views/admin/application_settings/_global_search_settings.html.haml b/app/views/admin/application_settings/_global_search_settings.html.haml index 1f20ddc7eb586b..980232b75b3f76 100644 --- a/app/views/admin/application_settings/_global_search_settings.html.haml +++ b/app/views/admin/application_settings/_global_search_settings.html.haml @@ -1,4 +1,4 @@ -= render ::Layouts::SettingsBlockComponent.new(_('Visibility & access controls'), += render ::Layouts::SettingsBlockComponent.new(_('Visibility and access controls'), id: 'js-global-search-settings', testid: 'admin-global-search-settings', expanded: expanded_by_default?) do |c| diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index 39d90a87b11158..9f4982696e917e 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -64,9 +64,9 @@ For more information, see [issue 477333](https://gitlab.com/gitlab-org/gitlab/-/ {{< history >}} - Restricting global search to authenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41041) in GitLab 13.4 [with a flag](../../administration/feature_flags.md) named `block_anonymous_global_searches`. Disabled by default. -- Enabling or disabling anonymous searches [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. -- Enabling or disabling anonymous global searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11 as a UI option, instead of the `block_anonymous_global_searches` flag. -- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0 as a UI option, instead of the `allow_anonymous_searches` flag. +- Anonymous search [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. +- Restricting global search to authenticated users [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11. Feature flag `block_anonymous_global_searches` removed. +- Anonymous search [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0. Feature flag `allow_anonymous_searches` removed. {{< /history >}} @@ -78,20 +78,21 @@ By default, requests to `/search` and global search are available for unauthenti To restrict `/search` to authenticated users only, do one of the following: -- [Restrict public visibility](../../administration/settings/visibility_and_access_controls.md#restrict-visibility-levels) - of the project or group. -- Change the admin setting to restrict search for only authenticated users by doing the following steps: +- [Restrict visibility levels](../../administration/settings/visibility_and_access_controls.md#restrict-visibility-levels) + for the project or group. +- Allow search for unauthenticated users: + 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. - 1. Expand **Advanced Search** - 1. Clear **Enable search for unauthenticated users**. + 1. Expand **Advanced search**. + 1. Clear the **Allow search for unauthenticated users** checkbox. 1. Select **Save changes**. To restrict global search to authenticated users only: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -1. Expand **Visibility & access controls** +1. Expand **Visibility and access controls** 1. Select **Restrict global search to authenticated users**. 1. Select **Save changes**. @@ -122,7 +123,7 @@ To disable one or more global search scopes: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -1. Expand **Visibility & access controls**. +1. Expand **Visibility and access controls**. 1. Clear the checkboxes for the scopes you want to disable. 1. Select **Save changes**. diff --git a/ee/spec/helpers/ee/application_settings_helper_spec.rb b/ee/spec/helpers/ee/application_settings_helper_spec.rb index c55a25c09f1f14..052b4cbe0d7e36 100644 --- a/ee/spec/helpers/ee/application_settings_helper_spec.rb +++ b/ee/spec/helpers/ee/application_settings_helper_spec.rb @@ -260,7 +260,7 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).to have_checked_field('Enable search for unauthenticated users', with: 1) + expect(result[0]).to have_checked_field('Allow search for unauthenticated users', with: 1) expect(result[1]).not_to have_checked_field('Restrict global search to authenticated users', with: 1) expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) @@ -269,7 +269,7 @@ expect(result[6]).to have_checked_field('Show code in global search results', with: 1) expect(result[7]).not_to have_checked_field('Show commits in global search results', with: 1) expect(result[8]).to have_checked_field('Show epics in global search results', with: 1) - expect(result[9]).to have_checked_field('Show wiki in global search results', with: 1) + expect(result[9]).to have_checked_field('Show wikis in global search results', with: 1) end end end diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb index 6cc379f200656e..70a7be9092a20e 100644 --- a/spec/helpers/application_settings_helper_spec.rb +++ b/spec/helpers/application_settings_helper_spec.rb @@ -402,7 +402,7 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).to have_checked_field('Enable search for unauthenticated users', with: 1) + expect(result[0]).to have_checked_field('Allow search for unauthenticated users', with: 1) expect(result[1]).to have_checked_field('Restrict global search to authenticated users', with: 1) expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) -- GitLab From fff1ffe2294dc322adcd9270202729e413c900e0 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 13:16:38 +0530 Subject: [PATCH 07/21] Update the ui text for wiki setting --- ee/app/helpers/ee/application_settings_helper.rb | 2 +- locale/gitlab.pot | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ee/app/helpers/ee/application_settings_helper.rb b/ee/app/helpers/ee/application_settings_helper.rb index eee36dca98f2ed..9213da0944b266 100644 --- a/ee/app/helpers/ee/application_settings_helper.rb +++ b/ee/app/helpers/ee/application_settings_helper.rb @@ -287,7 +287,7 @@ def global_search_settings_checkboxes(form) ), form.gitlab_ui_checkbox_component( :global_search_wiki_enabled, - _("Show wiki in global search results"), + _("Show wikis in global search results"), checkbox_options: { checked: @application_setting.global_search_wiki_enabled, multiple: false } ) ] diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 999233269db3b1..79d570181d5953 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6456,6 +6456,9 @@ msgstr "" msgid "Allow public access to pipelines and job details, including output logs and artifacts." msgstr "" +msgid "Allow search for unauthenticated users" +msgstr "" + msgid "Allow secret push protection" msgstr "" @@ -23889,9 +23892,6 @@ msgstr "" msgid "Enable repository checks" msgstr "" -msgid "Enable search for unauthenticated users" -msgstr "" - msgid "Enable searching" msgstr "" @@ -57330,7 +57330,7 @@ msgstr "" msgid "Show whitespace changes" msgstr "" -msgid "Show wiki in global search results" +msgid "Show wikis in global search results" msgstr "" msgid "Showing %d project." @@ -66596,9 +66596,6 @@ msgstr "" msgid "Visibility" msgstr "" -msgid "Visibility & access controls" -msgstr "" - msgid "Visibility and access controls" msgstr "" -- GitLab From 07c96b25da963adc7f968fe0379291aba1bad9df Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 13:43:13 +0530 Subject: [PATCH 08/21] Apply 4 suggestion(s) to 2 file(s) Co-authored-by: Ashraf Khamis --- .../application_settings/_global_search_settings.html.haml | 2 +- doc/user/search/_index.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/application_settings/_global_search_settings.html.haml b/app/views/admin/application_settings/_global_search_settings.html.haml index 980232b75b3f76..556971c61fd745 100644 --- a/app/views/admin/application_settings/_global_search_settings.html.haml +++ b/app/views/admin/application_settings/_global_search_settings.html.haml @@ -3,7 +3,7 @@ testid: 'admin-global-search-settings', expanded: expanded_by_default?) do |c| - c.with_description do - = _('Set visibility of search scopes and configure anonymous access.') + = _('Configure search access and visibility settings for search scopes.') = link_to _('Learn more.'), help_page_path('user/search/_index.md', anchor: 'disable-global-search-scopes'), target: '_blank', rel: 'noopener noreferrer' - c.with_body do = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-global-search-settings'), html: { class: 'fieldset-form', id: 'global-search-settings' } do |f| diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index 9f4982696e917e..ea481133d454dc 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -64,9 +64,9 @@ For more information, see [issue 477333](https://gitlab.com/gitlab-org/gitlab/-/ {{< history >}} - Restricting global search to authenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41041) in GitLab 13.4 [with a flag](../../administration/feature_flags.md) named `block_anonymous_global_searches`. Disabled by default. -- Anonymous search [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. +- Allowing search for unauthenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. - Restricting global search to authenticated users [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11. Feature flag `block_anonymous_global_searches` removed. -- Anonymous search [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0. Feature flag `allow_anonymous_searches` removed. +- Allowing search for unauthenticated users [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0. Feature flag `allow_anonymous_searches` removed. {{< /history >}} @@ -93,7 +93,7 @@ To restrict global search to authenticated users only: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. 1. Expand **Visibility and access controls** -1. Select **Restrict global search to authenticated users**. +1. Select the **Restrict global search to authenticated users** checkbox. 1. Select **Save changes**. ## Disable global search scopes -- GitLab From c74f85ce7fc708d63f004e01ae82028be4bb35de Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 15:05:46 +0530 Subject: [PATCH 09/21] Update gitlab.pot based on copy changes --- locale/gitlab.pot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 79d570181d5953..f8d566740d6806 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -16698,6 +16698,9 @@ msgstr "" msgid "Configure runner version management and registration settings." msgstr "" +msgid "Configure search access and visibility settings for search scopes." +msgstr "" + msgid "Configure settings for Advanced Search with Elasticsearch." msgstr "" @@ -57006,9 +57009,6 @@ msgstr "" msgid "Set variables on protected branches and tags only." msgstr "" -msgid "Set visibility of search scopes and configure anonymous access." -msgstr "" - msgid "Set weight" msgstr "" -- GitLab From 6457a5335893fb47d1379418a4c635174adbc7ba Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Fri, 2 May 2025 22:02:16 +0530 Subject: [PATCH 10/21] Replace ff with admin setting Changelog: other --- app/controllers/search_controller.rb | 2 +- config/feature_flags/ops/allow_anonymous_searches.yml | 8 -------- doc/user/search/_index.md | 10 ++++++++-- .../application_settings/_elasticsearch_form.html.haml | 3 +++ locale/gitlab.pot | 3 +++ spec/controllers/search_controller_spec.rb | 8 ++++---- 6 files changed, 19 insertions(+), 15 deletions(-) delete mode 100644 config/feature_flags/ops/allow_anonymous_searches.yml diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index d4dc75a523d03f..65a8869cc0de14 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -145,7 +145,7 @@ def authenticate? return true end - return true if ::Feature.disabled?(:allow_anonymous_searches, type: :ops) + return true unless ::Gitlab::CurrentSettings.anonymous_searches_allowed? false end diff --git a/config/feature_flags/ops/allow_anonymous_searches.yml b/config/feature_flags/ops/allow_anonymous_searches.yml deleted file mode 100644 index 248beb7c39d531..00000000000000 --- a/config/feature_flags/ops/allow_anonymous_searches.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: allow_anonymous_searches -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/434218 -milestone: '16.7' -type: ops -group: group::global search -default_enabled: true diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index ab8efb825178fe..6f6dd43bb4b2f7 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -65,7 +65,8 @@ For more information, see [issue 477333](https://gitlab.com/gitlab-org/gitlab/-/ - Restricting global search to authenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41041) in GitLab 13.4 [with a flag](../../administration/feature_flags.md) named `block_anonymous_global_searches`. Disabled by default. - Enabling or disabling anonymous searches [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. -- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11 as a UI option, instead of the `block_anonymous_global_searches` flag. +- Enabling or disabling anonymous global searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11 as a UI option, instead of the `block_anonymous_global_searches` flag. +- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190080) in GitLab 18.0 as a UI option, instead of the `allow_anonymous_searches` flag. {{< /history >}} @@ -79,7 +80,12 @@ To restrict `/search` to authenticated users only, do one of the following: - [Restrict public visibility](../../administration/settings/visibility_and_access_controls.md#restrict-visibility-levels) of the project or group. -- Disable the [feature flag](../../administration/feature_flags.md) `allow_anonymous_searches`. +- Change the admin setting to restrict search for only authenticated users by doing the following steps: + 1. On the left sidebar, at the bottom, select **Admin**. + 1. Select **Settings > Search**. + 1. Expand **Advanced Search** + 1. Clear **Enable search for unauthenticated users**. + 1. Select **Save changes**. To restrict global search to authenticated users only: diff --git a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml index 69b065161eac65..e0041d3b86d28c 100644 --- a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml +++ b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml @@ -51,6 +51,9 @@ .form-group = f.gitlab_ui_checkbox_component :elasticsearch_requeue_workers, s_('AdminSettings|Requeue indexing workers'), help_text: s_('AdminSettings|Improve non-code indexing throughput by enqueuing Sidekiq jobs until all documents are processed.') + .form-group + = f.gitlab_ui_checkbox_component :anonymous_searches_allowed, s_('AdminSettings|Enable search for unauthenticated users') + .form-group = f.label :elasticsearch_url, 'URL', class: 'label-bold' = f.text_field :elasticsearch_url, value: @application_setting.elasticsearch_url.join(', '), class: 'form-control gl-form-input', placeholder: 'http://localhost:9200, http://localhost:9201', data: { testid: 'url-field' } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index be86a92c175396..baa3c08636d467 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4562,6 +4562,9 @@ msgstr "" msgid "AdminSettings|Enable product analytics" msgstr "" +msgid "AdminSettings|Enable search for unauthenticated users" +msgstr "" + msgid "AdminSettings|Enable smartcn custom analyzer: Indexing" msgstr "" diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb index 713c18f263996b..9fbc9fba743a16 100644 --- a/spec/controllers/search_controller_spec.rb +++ b/spec/controllers/search_controller_spec.rb @@ -252,9 +252,9 @@ end end - context 'when allow_anonymous_searches is disabled' do + context 'when anonymous_searches_allowed is disabled' do before do - stub_feature_flags(allow_anonymous_searches: false) + stub_application_setting(anonymous_searches_allowed: false) end context 'for unauthenticated user' do @@ -754,7 +754,7 @@ def request describe 'redirecting' do using RSpec::Parameterized::TableSyntax - where(:restricted_visibility_levels, :allow_anonymous_searches, :block_anonymous_global_searches, :redirect) do + where(:restricted_visibility_levels, :anonymous_searches_allowed, :block_anonymous_global_searches, :redirect) do [Gitlab::VisibilityLevel::PUBLIC] | true | false | true [Gitlab::VisibilityLevel::PRIVATE] | true | false | false nil | true | false | false @@ -766,7 +766,7 @@ def request with_them do before do stub_application_setting(restricted_visibility_levels: restricted_visibility_levels) - stub_feature_flags(allow_anonymous_searches: allow_anonymous_searches) + stub_application_setting(anonymous_searches_allowed: anonymous_searches_allowed) stub_application_setting(global_search_block_anonymous_searches_enabled: block_anonymous_global_searches) end -- GitLab From 00e71caf331b878e06ed97a9ca49040f5efdb2b0 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Sat, 3 May 2025 09:46:09 +0530 Subject: [PATCH 11/21] Add changes for Settings --- app/helpers/application_settings_helper.rb | 7 +++++++ .../_global_search_settings.html.haml | 4 ++-- .../_elasticsearch_form.html.haml | 3 --- locale/gitlab.pot | 18 +++++++++--------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 8a8860b3fe2339..eeb339fa72df70 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -74,6 +74,13 @@ def enabled_protocol_button(container, protocol) def global_search_settings_checkboxes(form) [ + form.gitlab_ui_checkbox_component( + :anonymous_searches_allowed, + _("Enable search for unauthenticated users"), + checkbox_options: { + checked: @application_setting.anonymous_searches_allowed, multiple: false + } + ), form.gitlab_ui_checkbox_component( :global_search_block_anonymous_searches_enabled, _("Restrict global search to authenticated users"), diff --git a/app/views/admin/application_settings/_global_search_settings.html.haml b/app/views/admin/application_settings/_global_search_settings.html.haml index 84986941cb9d55..1f20ddc7eb586b 100644 --- a/app/views/admin/application_settings/_global_search_settings.html.haml +++ b/app/views/admin/application_settings/_global_search_settings.html.haml @@ -1,9 +1,9 @@ -= render ::Layouts::SettingsBlockComponent.new(_('Global Search'), += render ::Layouts::SettingsBlockComponent.new(_('Visibility & access controls'), id: 'js-global-search-settings', testid: 'admin-global-search-settings', expanded: expanded_by_default?) do |c| - c.with_description do - = _('Configure settings for global search.') + = _('Set visibility of search scopes and configure anonymous access.') = link_to _('Learn more.'), help_page_path('user/search/_index.md', anchor: 'disable-global-search-scopes'), target: '_blank', rel: 'noopener noreferrer' - c.with_body do = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-global-search-settings'), html: { class: 'fieldset-form', id: 'global-search-settings' } do |f| diff --git a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml index e0041d3b86d28c..69b065161eac65 100644 --- a/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml +++ b/ee/app/views/admin/application_settings/_elasticsearch_form.html.haml @@ -51,9 +51,6 @@ .form-group = f.gitlab_ui_checkbox_component :elasticsearch_requeue_workers, s_('AdminSettings|Requeue indexing workers'), help_text: s_('AdminSettings|Improve non-code indexing throughput by enqueuing Sidekiq jobs until all documents are processed.') - .form-group - = f.gitlab_ui_checkbox_component :anonymous_searches_allowed, s_('AdminSettings|Enable search for unauthenticated users') - .form-group = f.label :elasticsearch_url, 'URL', class: 'label-bold' = f.text_field :elasticsearch_url, value: @application_setting.elasticsearch_url.join(', '), class: 'form-control gl-form-input', placeholder: 'http://localhost:9200, http://localhost:9201', data: { testid: 'url-field' } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index baa3c08636d467..000aed01721a39 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4562,9 +4562,6 @@ msgstr "" msgid "AdminSettings|Enable product analytics" msgstr "" -msgid "AdminSettings|Enable search for unauthenticated users" -msgstr "" - msgid "AdminSettings|Enable smartcn custom analyzer: Indexing" msgstr "" @@ -16725,9 +16722,6 @@ msgstr "" msgid "Configure settings for exact code search." msgstr "" -msgid "Configure settings for global search." -msgstr "" - msgid "Configure specific limits for Files API requests that supersede the general user and IP rate limits." msgstr "" @@ -23916,6 +23910,9 @@ msgstr "" msgid "Enable repository checks" msgstr "" +msgid "Enable search for unauthenticated users" +msgstr "" + msgid "Enable searching" msgstr "" @@ -28349,9 +28346,6 @@ msgstr "" msgid "Global SAML group membership lock" msgstr "" -msgid "Global Search" -msgstr "" - msgid "Global Search is disabled for this scope" msgstr "" @@ -57054,6 +57048,9 @@ msgstr "" msgid "Set variables on protected branches and tags only." msgstr "" +msgid "Set visibility of search scopes and configure anonymous access." +msgstr "" + msgid "Set weight" msgstr "" @@ -66641,6 +66638,9 @@ msgstr "" msgid "Visibility" msgstr "" +msgid "Visibility & access controls" +msgstr "" + msgid "Visibility and access controls" msgstr "" -- GitLab From 1dc6b73548bd1e6ff774697788eb225f15678c99 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Sat, 3 May 2025 09:48:07 +0530 Subject: [PATCH 12/21] Update docs based on rename --- doc/user/search/_index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index 6f6dd43bb4b2f7..a5ed7932afe816 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -91,7 +91,7 @@ To restrict global search to authenticated users only: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -1. Expand **Global search** +1. Expand **Visibility & access controls** 1. Select **Restrict global search to authenticated users**. 1. Select **Save changes**. @@ -122,7 +122,7 @@ To disable one or more global search scopes: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -1. Expand **Global search**. +1. Expand **Visibility & access controls**. 1. Clear the checkboxes for the scopes you want to disable. 1. Select **Save changes**. -- GitLab From f4c934d5efa7f42a735b5a9cc3fb855f1bcdf9db Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Fri, 2 May 2025 22:12:13 +0530 Subject: [PATCH 13/21] Apply 1 suggestion(s) to 1 file(s) --- doc/user/search/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index a5ed7932afe816..39d90a87b11158 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -66,7 +66,7 @@ For more information, see [issue 477333](https://gitlab.com/gitlab-org/gitlab/-/ - Restricting global search to authenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41041) in GitLab 13.4 [with a flag](../../administration/feature_flags.md) named `block_anonymous_global_searches`. Disabled by default. - Enabling or disabling anonymous searches [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. - Enabling or disabling anonymous global searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11 as a UI option, instead of the `block_anonymous_global_searches` flag. -- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190080) in GitLab 18.0 as a UI option, instead of the `allow_anonymous_searches` flag. +- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0 as a UI option, instead of the `allow_anonymous_searches` flag. {{< /history >}} -- GitLab From ffdf136e4ee0444c7e9c1969f9c2430c5d832539 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Sat, 3 May 2025 10:37:10 +0530 Subject: [PATCH 14/21] Fix failing spec --- .../ee/application_settings_helper_spec.rb | 19 ++++++++++--------- .../application_settings_helper_spec.rb | 11 ++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ee/spec/helpers/ee/application_settings_helper_spec.rb b/ee/spec/helpers/ee/application_settings_helper_spec.rb index 1ce11724401089..c55a25c09f1f14 100644 --- a/ee/spec/helpers/ee/application_settings_helper_spec.rb +++ b/ee/spec/helpers/ee/application_settings_helper_spec.rb @@ -260,15 +260,16 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).not_to have_checked_field('Restrict global search to authenticated users', with: 1) - expect(result[1]).to have_checked_field('Show issues in global search results', with: 1) - expect(result[2]).not_to have_checked_field('Show merge requests in global search results', with: 1) - expect(result[3]).to have_checked_field('Show snippets in global search results', with: 1) - expect(result[4]).not_to have_checked_field('Show users in global search results', with: 1) - expect(result[5]).to have_checked_field('Show code in global search results', with: 1) - expect(result[6]).not_to have_checked_field('Show commits in global search results', with: 1) - expect(result[7]).to have_checked_field('Show epics in global search results', with: 1) - expect(result[8]).to have_checked_field('Show wiki in global search results', with: 1) + expect(result[0]).to have_checked_field('Enable search for unauthenticated users', with: 1) + expect(result[1]).not_to have_checked_field('Restrict global search to authenticated users', with: 1) + expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) + expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) + expect(result[4]).to have_checked_field('Show snippets in global search results', with: 1) + expect(result[5]).not_to have_checked_field('Show users in global search results', with: 1) + expect(result[6]).to have_checked_field('Show code in global search results', with: 1) + expect(result[7]).not_to have_checked_field('Show commits in global search results', with: 1) + expect(result[8]).to have_checked_field('Show epics in global search results', with: 1) + expect(result[9]).to have_checked_field('Show wiki in global search results', with: 1) end end end diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb index 4c59e8a688153b..6cc379f200656e 100644 --- a/spec/helpers/application_settings_helper_spec.rb +++ b/spec/helpers/application_settings_helper_spec.rb @@ -402,11 +402,12 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).to have_checked_field('Restrict global search to authenticated users', with: 1) - expect(result[1]).to have_checked_field('Show issues in global search results', with: 1) - expect(result[2]).not_to have_checked_field('Show merge requests in global search results', with: 1) - expect(result[3]).to have_checked_field('Show snippets in global search results', with: 1) - expect(result[4]).not_to have_checked_field('Show users in global search results', with: 1) + expect(result[0]).to have_checked_field('Enable search for unauthenticated users', with: 1) + expect(result[1]).to have_checked_field('Restrict global search to authenticated users', with: 1) + expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) + expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) + expect(result[4]).to have_checked_field('Show snippets in global search results', with: 1) + expect(result[5]).not_to have_checked_field('Show users in global search results', with: 1) end end end -- GitLab From 46c0699decc54e7e0fe59cdeacdb5fbc0ca2933d Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 13:14:42 +0530 Subject: [PATCH 15/21] Apply 12 suggestion(s) to 5 file(s) Co-authored-by: Ashraf Khamis --- app/helpers/application_settings_helper.rb | 2 +- .../_global_search_settings.html.haml | 2 +- doc/user/search/_index.md | 21 ++++++++++--------- .../ee/application_settings_helper_spec.rb | 4 ++-- .../application_settings_helper_spec.rb | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index eeb339fa72df70..e7fb842c330cf3 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -76,7 +76,7 @@ def global_search_settings_checkboxes(form) [ form.gitlab_ui_checkbox_component( :anonymous_searches_allowed, - _("Enable search for unauthenticated users"), + _("Allow search for unauthenticated users"), checkbox_options: { checked: @application_setting.anonymous_searches_allowed, multiple: false } diff --git a/app/views/admin/application_settings/_global_search_settings.html.haml b/app/views/admin/application_settings/_global_search_settings.html.haml index 1f20ddc7eb586b..980232b75b3f76 100644 --- a/app/views/admin/application_settings/_global_search_settings.html.haml +++ b/app/views/admin/application_settings/_global_search_settings.html.haml @@ -1,4 +1,4 @@ -= render ::Layouts::SettingsBlockComponent.new(_('Visibility & access controls'), += render ::Layouts::SettingsBlockComponent.new(_('Visibility and access controls'), id: 'js-global-search-settings', testid: 'admin-global-search-settings', expanded: expanded_by_default?) do |c| diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index 39d90a87b11158..9f4982696e917e 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -64,9 +64,9 @@ For more information, see [issue 477333](https://gitlab.com/gitlab-org/gitlab/-/ {{< history >}} - Restricting global search to authenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41041) in GitLab 13.4 [with a flag](../../administration/feature_flags.md) named `block_anonymous_global_searches`. Disabled by default. -- Enabling or disabling anonymous searches [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. -- Enabling or disabling anonymous global searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11 as a UI option, instead of the `block_anonymous_global_searches` flag. -- Enabling or disabling anonymous searches [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0 as a UI option, instead of the `allow_anonymous_searches` flag. +- Anonymous search [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. +- Restricting global search to authenticated users [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11. Feature flag `block_anonymous_global_searches` removed. +- Anonymous search [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0. Feature flag `allow_anonymous_searches` removed. {{< /history >}} @@ -78,20 +78,21 @@ By default, requests to `/search` and global search are available for unauthenti To restrict `/search` to authenticated users only, do one of the following: -- [Restrict public visibility](../../administration/settings/visibility_and_access_controls.md#restrict-visibility-levels) - of the project or group. -- Change the admin setting to restrict search for only authenticated users by doing the following steps: +- [Restrict visibility levels](../../administration/settings/visibility_and_access_controls.md#restrict-visibility-levels) + for the project or group. +- Allow search for unauthenticated users: + 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. - 1. Expand **Advanced Search** - 1. Clear **Enable search for unauthenticated users**. + 1. Expand **Advanced search**. + 1. Clear the **Allow search for unauthenticated users** checkbox. 1. Select **Save changes**. To restrict global search to authenticated users only: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -1. Expand **Visibility & access controls** +1. Expand **Visibility and access controls** 1. Select **Restrict global search to authenticated users**. 1. Select **Save changes**. @@ -122,7 +123,7 @@ To disable one or more global search scopes: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -1. Expand **Visibility & access controls**. +1. Expand **Visibility and access controls**. 1. Clear the checkboxes for the scopes you want to disable. 1. Select **Save changes**. diff --git a/ee/spec/helpers/ee/application_settings_helper_spec.rb b/ee/spec/helpers/ee/application_settings_helper_spec.rb index c55a25c09f1f14..052b4cbe0d7e36 100644 --- a/ee/spec/helpers/ee/application_settings_helper_spec.rb +++ b/ee/spec/helpers/ee/application_settings_helper_spec.rb @@ -260,7 +260,7 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).to have_checked_field('Enable search for unauthenticated users', with: 1) + expect(result[0]).to have_checked_field('Allow search for unauthenticated users', with: 1) expect(result[1]).not_to have_checked_field('Restrict global search to authenticated users', with: 1) expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) @@ -269,7 +269,7 @@ expect(result[6]).to have_checked_field('Show code in global search results', with: 1) expect(result[7]).not_to have_checked_field('Show commits in global search results', with: 1) expect(result[8]).to have_checked_field('Show epics in global search results', with: 1) - expect(result[9]).to have_checked_field('Show wiki in global search results', with: 1) + expect(result[9]).to have_checked_field('Show wikis in global search results', with: 1) end end end diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb index 6cc379f200656e..70a7be9092a20e 100644 --- a/spec/helpers/application_settings_helper_spec.rb +++ b/spec/helpers/application_settings_helper_spec.rb @@ -402,7 +402,7 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).to have_checked_field('Enable search for unauthenticated users', with: 1) + expect(result[0]).to have_checked_field('Allow search for unauthenticated users', with: 1) expect(result[1]).to have_checked_field('Restrict global search to authenticated users', with: 1) expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) -- GitLab From 713f465d3163f644ff93969a0d0cbe342566ceb3 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 13:16:38 +0530 Subject: [PATCH 16/21] Update the ui text for wiki setting --- ee/app/helpers/ee/application_settings_helper.rb | 2 +- locale/gitlab.pot | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ee/app/helpers/ee/application_settings_helper.rb b/ee/app/helpers/ee/application_settings_helper.rb index 215ba426ca39d8..ea9a183acf8007 100644 --- a/ee/app/helpers/ee/application_settings_helper.rb +++ b/ee/app/helpers/ee/application_settings_helper.rb @@ -286,7 +286,7 @@ def global_search_settings_checkboxes(form) ), form.gitlab_ui_checkbox_component( :global_search_wiki_enabled, - _("Show wiki in global search results"), + _("Show wikis in global search results"), checkbox_options: { checked: @application_setting.global_search_wiki_enabled, multiple: false } ) ] diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 000aed01721a39..c092a8307ea67c 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6474,6 +6474,9 @@ msgstr "" msgid "Allow public access to pipelines and job details, including output logs and artifacts." msgstr "" +msgid "Allow search for unauthenticated users" +msgstr "" + msgid "Allow secret push protection" msgstr "" @@ -23910,9 +23913,6 @@ msgstr "" msgid "Enable repository checks" msgstr "" -msgid "Enable search for unauthenticated users" -msgstr "" - msgid "Enable searching" msgstr "" @@ -57372,7 +57372,7 @@ msgstr "" msgid "Show whitespace changes" msgstr "" -msgid "Show wiki in global search results" +msgid "Show wikis in global search results" msgstr "" msgid "Showing %d project." @@ -66638,9 +66638,6 @@ msgstr "" msgid "Visibility" msgstr "" -msgid "Visibility & access controls" -msgstr "" - msgid "Visibility and access controls" msgstr "" -- GitLab From e8acda5718ca6c4ee836f19dce39e07404279f77 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 13:43:13 +0530 Subject: [PATCH 17/21] Apply 4 suggestion(s) to 2 file(s) Co-authored-by: Ashraf Khamis --- .../application_settings/_global_search_settings.html.haml | 2 +- doc/user/search/_index.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/application_settings/_global_search_settings.html.haml b/app/views/admin/application_settings/_global_search_settings.html.haml index 980232b75b3f76..556971c61fd745 100644 --- a/app/views/admin/application_settings/_global_search_settings.html.haml +++ b/app/views/admin/application_settings/_global_search_settings.html.haml @@ -3,7 +3,7 @@ testid: 'admin-global-search-settings', expanded: expanded_by_default?) do |c| - c.with_description do - = _('Set visibility of search scopes and configure anonymous access.') + = _('Configure search access and visibility settings for search scopes.') = link_to _('Learn more.'), help_page_path('user/search/_index.md', anchor: 'disable-global-search-scopes'), target: '_blank', rel: 'noopener noreferrer' - c.with_body do = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-global-search-settings'), html: { class: 'fieldset-form', id: 'global-search-settings' } do |f| diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index 9f4982696e917e..ea481133d454dc 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -64,9 +64,9 @@ For more information, see [issue 477333](https://gitlab.com/gitlab-org/gitlab/-/ {{< history >}} - Restricting global search to authenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41041) in GitLab 13.4 [with a flag](../../administration/feature_flags.md) named `block_anonymous_global_searches`. Disabled by default. -- Anonymous search [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. +- Allowing search for unauthenticated users [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138975) in GitLab 16.7 [with a flag](../../administration/feature_flags.md) named `allow_anonymous_searches`. Enabled by default. - Restricting global search to authenticated users [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/186727) in GitLab 17.11. Feature flag `block_anonymous_global_searches` removed. -- Anonymous search [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0. Feature flag `allow_anonymous_searches` removed. +- Allowing search for unauthenticated users [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/190090) in GitLab 18.0. Feature flag `allow_anonymous_searches` removed. {{< /history >}} @@ -93,7 +93,7 @@ To restrict global search to authenticated users only: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. 1. Expand **Visibility and access controls** -1. Select **Restrict global search to authenticated users**. +1. Select the **Restrict global search to authenticated users** checkbox. 1. Select **Save changes**. ## Disable global search scopes -- GitLab From 13b43e3a4a8820b1e92d35c01f5a8b315f1836ba Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 15:05:46 +0530 Subject: [PATCH 18/21] Update gitlab.pot based on copy changes --- locale/gitlab.pot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index c092a8307ea67c..4410f448c7e0d5 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -16719,6 +16719,9 @@ msgstr "" msgid "Configure runner version management and registration settings." msgstr "" +msgid "Configure search access and visibility settings for search scopes." +msgstr "" + msgid "Configure settings for Advanced Search with Elasticsearch." msgstr "" @@ -57048,9 +57051,6 @@ msgstr "" msgid "Set variables on protected branches and tags only." msgstr "" -msgid "Set visibility of search scopes and configure anonymous access." -msgstr "" - msgid "Set weight" msgstr "" -- GitLab From aa0c0d2db398330be5fae838a48ac407b34ced7b Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 15:50:49 +0530 Subject: [PATCH 19/21] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Ashraf Khamis --- doc/user/search/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index ea481133d454dc..0d529da74deb7b 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -80,7 +80,7 @@ To restrict `/search` to authenticated users only, do one of the following: - [Restrict visibility levels](../../administration/settings/visibility_and_access_controls.md#restrict-visibility-levels) for the project or group. -- Allow search for unauthenticated users: +- Restrict access in the **Admin** area: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. -- GitLab From 56eedba2b4025d48b115531e45afbae0fc690e6a Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Mon, 5 May 2025 23:32:39 +0530 Subject: [PATCH 20/21] Apply 1 suggestion(s) to 1 file(s) --- .../application_settings/_global_search_settings.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/application_settings/_global_search_settings.html.haml b/app/views/admin/application_settings/_global_search_settings.html.haml index 556971c61fd745..cb9cd7b4e41942 100644 --- a/app/views/admin/application_settings/_global_search_settings.html.haml +++ b/app/views/admin/application_settings/_global_search_settings.html.haml @@ -4,7 +4,7 @@ expanded: expanded_by_default?) do |c| - c.with_description do = _('Configure search access and visibility settings for search scopes.') - = link_to _('Learn more.'), help_page_path('user/search/_index.md', anchor: 'disable-global-search-scopes'), target: '_blank', rel: 'noopener noreferrer' + = link_to _('Learn more.'), help_page_path('user/search/_index.md', anchor: 'restrict-search-access'), target: '_blank', rel: 'noopener noreferrer' - c.with_body do = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-global-search-settings'), html: { class: 'fieldset-form', id: 'global-search-settings' } do |f| = form_errors(@application_setting) -- GitLab From 57d43eccf3061a7653ebdedbcb2ec2ac40983889 Mon Sep 17 00:00:00 2001 From: Siddharth Dungarwal Date: Tue, 6 May 2025 14:15:37 +0530 Subject: [PATCH 21/21] Add copy changes as per suggestions --- app/helpers/application_settings_helper.rb | 4 ++-- doc/user/search/_index.md | 4 ++-- ee/spec/helpers/ee/application_settings_helper_spec.rb | 4 ++-- locale/gitlab.pot | 8 ++++---- spec/helpers/application_settings_helper_spec.rb | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index e7fb842c330cf3..774bddf5f21ee0 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -76,14 +76,14 @@ def global_search_settings_checkboxes(form) [ form.gitlab_ui_checkbox_component( :anonymous_searches_allowed, - _("Allow search for unauthenticated users"), + _("Allow unauthenticated users to use search"), checkbox_options: { checked: @application_setting.anonymous_searches_allowed, multiple: false } ), form.gitlab_ui_checkbox_component( :global_search_block_anonymous_searches_enabled, - _("Restrict global search to authenticated users"), + _("Restrict global search to authenticated users only"), checkbox_options: { checked: @application_setting.global_search_block_anonymous_searches_enabled, multiple: false } diff --git a/doc/user/search/_index.md b/doc/user/search/_index.md index 0d529da74deb7b..7c925934d69fd0 100644 --- a/doc/user/search/_index.md +++ b/doc/user/search/_index.md @@ -85,7 +85,7 @@ To restrict `/search` to authenticated users only, do one of the following: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. 1. Expand **Advanced search**. - 1. Clear the **Allow search for unauthenticated users** checkbox. + 1. Clear the **Allow unauthenticated users to use search** checkbox. 1. Select **Save changes**. To restrict global search to authenticated users only: @@ -93,7 +93,7 @@ To restrict global search to authenticated users only: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Search**. 1. Expand **Visibility and access controls** -1. Select the **Restrict global search to authenticated users** checkbox. +1. Select the **Restrict global search to authenticated users only** checkbox. 1. Select **Save changes**. ## Disable global search scopes diff --git a/ee/spec/helpers/ee/application_settings_helper_spec.rb b/ee/spec/helpers/ee/application_settings_helper_spec.rb index 052b4cbe0d7e36..7d8d4899fc519e 100644 --- a/ee/spec/helpers/ee/application_settings_helper_spec.rb +++ b/ee/spec/helpers/ee/application_settings_helper_spec.rb @@ -260,8 +260,8 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).to have_checked_field('Allow search for unauthenticated users', with: 1) - expect(result[1]).not_to have_checked_field('Restrict global search to authenticated users', with: 1) + expect(result[0]).to have_checked_field('Allow unauthenticated users to use search', with: 1) + expect(result[1]).not_to have_checked_field('Restrict global search to authenticated users only', with: 1) expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) expect(result[4]).to have_checked_field('Show snippets in global search results', with: 1) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 4410f448c7e0d5..cf835046054053 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6474,9 +6474,6 @@ msgstr "" msgid "Allow public access to pipelines and job details, including output logs and artifacts." msgstr "" -msgid "Allow search for unauthenticated users" -msgstr "" - msgid "Allow secret push protection" msgstr "" @@ -6486,6 +6483,9 @@ msgstr "" msgid "Allow top-level group owners to create Service accounts." msgstr "" +msgid "Allow unauthenticated users to use search" +msgstr "" + msgid "Allow use of licensed EE features" msgstr "" @@ -51162,7 +51162,7 @@ msgstr "" msgid "Restrict access by IP address" msgstr "" -msgid "Restrict global search to authenticated users" +msgid "Restrict global search to authenticated users only" msgstr "" msgid "Restrict membership by email domain" diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb index 70a7be9092a20e..5833a674e8194b 100644 --- a/spec/helpers/application_settings_helper_spec.rb +++ b/spec/helpers/application_settings_helper_spec.rb @@ -402,8 +402,8 @@ it 'returns correctly checked checkboxes' do helper.gitlab_ui_form_for(application_setting, url: search_admin_application_settings_path) do |form| result = helper.global_search_settings_checkboxes(form) - expect(result[0]).to have_checked_field('Allow search for unauthenticated users', with: 1) - expect(result[1]).to have_checked_field('Restrict global search to authenticated users', with: 1) + expect(result[0]).to have_checked_field('Allow unauthenticated users to use search', with: 1) + expect(result[1]).to have_checked_field('Restrict global search to authenticated users only', with: 1) expect(result[2]).to have_checked_field('Show issues in global search results', with: 1) expect(result[3]).not_to have_checked_field('Show merge requests in global search results', with: 1) expect(result[4]).to have_checked_field('Show snippets in global search results', with: 1) -- GitLab