Commit fe76a236 authored by Igor Drozdov's avatar Igor Drozdov

Merge branch '255328_allow_to_set_documentation_pages_url' into 'master'

Allow to setup Documentation pages URL for help pages redirects

See merge request gitlab-org/gitlab!71737
parents d0f22537 3f3566ab
......@@ -72,7 +72,6 @@ class HelpController < ApplicationController
end
def redirect_to_documentation_website?
return false unless Feature.enabled?(:help_page_documentation_redirect)
return false unless Gitlab::UrlSanitizer.valid_web?(documentation_url)
true
......
......@@ -471,10 +471,6 @@ module ApplicationSettingsHelper
}
end
def show_documentation_base_url_field?
Feature.enabled?(:help_page_documentation_redirect)
end
def valid_runner_registrars
Gitlab::CurrentSettings.valid_runner_registrars
end
......
......@@ -18,11 +18,10 @@
= f.text_field :help_page_support_url, class: 'form-control gl-form-input', placeholder: 'https://company.example.com/getting-help', :'aria-describedby' => 'support_help_block'
%span.form-text.text-muted#support_help_block= _('Alternate support URL for Help page and Help dropdown.')
- if show_documentation_base_url_field?
.form-group
= f.label :help_page_documentation_base_url, _('Documentation pages URL'), class: 'label-bold'
= f.text_field :help_page_documentation_base_url, class: 'form-control gl-form-input', placeholder: 'https://docs.gitlab.com'
- docs_link_url = help_page_path('user/admin_area/settings/help_page', anchor: 'destination-requirements')
- docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: docs_link_url }
%span.form-text.text-muted#support_help_block= html_escape(_('Requests for pages at %{code_start}%{help_text_url}%{code_end} redirect to the URL. The destination must meet certain requirements. %{docs_link_start}Learn more.%{docs_link_end}')) % { code_start: '<code>'.html_safe, help_text_url: help_url, code_end: '</code>'.html_safe, docs_link_start: docs_link_start, docs_link_end: '</a>'.html_safe }
.form-group
= f.label :help_page_documentation_base_url, _('Documentation pages URL'), class: 'gl-font-weight-bold'
= f.text_field :help_page_documentation_base_url, class: 'form-control gl-form-input', placeholder: 'https://docs.gitlab.com'
- docs_link_url = help_page_path('user/admin_area/settings/help_page', anchor: 'destination-requirements')
- docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: docs_link_url }
%span.form-text.text-muted#support_help_block= html_escape(_('Requests for pages at %{code_start}%{help_text_url}%{code_end} redirect to the URL. The destination must meet certain requirements. %{docs_link_start}Learn more.%{docs_link_end}')) % { code_start: '<code>'.html_safe, help_text_url: help_url, code_end: '</code>'.html_safe, docs_link_start: docs_link_start, docs_link_end: '</a>'.html_safe }
= f.submit _('Save changes'), class: "gl-button btn btn-confirm"
---
name: help_page_documentation_redirect
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42702
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/255328
milestone: '13.5'
type: development
group: group::static site editor
default_enabled: false
......@@ -68,12 +68,9 @@ You can specify a custom URL to which users are directed when they:
## Redirect `/help` pages
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43157) in GitLab 13.5.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to
[enable the `:help_page_documentation_redirect` flag](../../../administration/feature_flags.md).
On GitLab.com, this feature is available but can be configured by GitLab.com administrators only.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43157) in GitLab 13.5.
> - [Feature flag `help_page_documentation_redirect`](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71737) removed in GitLab 14.4.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71737) in GitLab 14.4.
The `/help` URL of a GitLab instance displays a basic version of the documentation sourced from the
[`doc` directory](https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc) of GitLab. `/help` links
......
......@@ -34,14 +34,6 @@ RSpec.describe HelpController do
is_expected.to redirect_to("#{documentation_base_url}/ee/#{path}.html")
end
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(help_page_documentation_redirect: false)
end
it_behaves_like 'documentation pages local render'
end
end
before do
......
......@@ -661,8 +661,6 @@ RSpec.describe 'Admin updates settings' do
end
it 'change Help page' do
stub_feature_flags(help_page_documentation_redirect: true)
new_support_url = 'http://example.com/help'
new_documentation_url = 'https://docs.gitlab.com'
......
......@@ -158,26 +158,6 @@ RSpec.describe ApplicationSettingsHelper do
end
end
describe '.show_documentation_base_url_field?' do
subject { helper.show_documentation_base_url_field? }
before do
stub_feature_flags(help_page_documentation_redirect: feature_flag)
end
context 'when feature flag is enabled' do
let(:feature_flag) { true }
it { is_expected.to eq(true) }
end
context 'when feature flag is disabled' do
let(:feature_flag) { false }
it { is_expected.to eq(false) }
end
end
describe '.valid_runner_registrars' do
subject { helper.valid_runner_registrars }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment