Skip to content
代码片段 群组 项目
未验证 提交 b51e610d 编辑于 作者: Thomas Hutterer's avatar Thomas Hutterer 提交者: GitLab
浏览文件

Fix link to self-hosted docs in sidebar help menu

Changelog: fixed
上级 9c22b944
No related branches found
No related tags found
无相关合并请求
......@@ -8,7 +8,7 @@ import {
} from '@gitlab/ui';
import GitlabVersionCheckBadge from '~/gitlab_version_check/components/gitlab_version_check_badge.vue';
import { helpPagePath } from '~/helpers/help_page_helper';
import { FORUM_URL, DOCS_URL, PROMO_URL } from 'jh_else_ce/lib/utils/url_utility';
import { FORUM_URL, PROMO_URL } from 'jh_else_ce/lib/utils/url_utility';
import { __, s__ } from '~/locale';
import { STORAGE_KEY } from '~/whats_new/utils/notification';
import Tracking from '~/tracking';
......@@ -92,7 +92,7 @@ export default {
},
{
text: this.$options.i18n.docs,
href: DOCS_URL,
href: this.sidebarData.docs_path,
extraAttrs: {
...this.trackingAttrs('gitlab_documentation'),
},
......@@ -113,7 +113,7 @@ export default {
},
{
text: this.$options.i18n.contribute,
href: helpPagePath('', { anchor: 'contributing-to-gitlab' }),
href: helpPagePath('', { anchor: 'contribute-to-gitlab' }),
extraAttrs: {
...this.trackingAttrs('contribute_to_gitlab'),
},
......
......@@ -51,6 +51,10 @@ def show
end
end
def redirect_to_docs
redirect_to documentation_base_url
end
def shortcuts
end
......
......@@ -49,6 +49,7 @@ def super_sidebar_logged_out_context(panel:, panel_type:) # rubocop:disable Metr
current_menu_items: panel.super_sidebar_menu_items,
current_context_header: panel.super_sidebar_context_header,
support_path: support_url,
docs_path: help_docs_path,
display_whats_new: display_whats_new?,
whats_new_most_recent_release_items_count: whats_new_most_recent_release_items_count,
whats_new_version_digest: whats_new_version_digest,
......
......@@ -4,4 +4,5 @@
get 'help/shortcuts' => 'help#shortcuts'
get 'help/instance_configuration' => 'help#instance_configuration'
get 'help/drawers/*markdown_file' => 'help#drawers'
get 'help/docs' => 'help#redirect_to_docs'
get 'help/*path' => 'help#show', as: :help_page
......@@ -404,6 +404,32 @@
end
end
describe 'GET #docs' do
subject { get :redirect_to_docs }
context 'with no custom docs URL configured' do
it 'redirects to docs.gitlab.com' do
subject
expect(response).to redirect_to('https://docs.gitlab.com')
end
end
context 'with a custom docs URL configured' do
let(:custom_docs_url) { 'https://foo.example.com' }
before do
stub_application_setting(help_page_documentation_base_url: custom_docs_url)
end
it 'redirects to the configured docs URL' do
subject
expect(response).to redirect_to(custom_docs_url)
end
end
end
def stub_two_factor_required
allow(controller).to receive(:two_factor_authentication_required?).and_return(true)
allow(controller).to receive(:current_user_requires_two_factor?).and_return(true)
......
......@@ -4,7 +4,7 @@ import toggleWhatsNewDrawer from '~/whats_new';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import HelpCenter from '~/super_sidebar/components/help_center.vue';
import { helpPagePath } from '~/helpers/help_page_helper';
import { DOCS_URL, FORUM_URL, PROMO_URL } from 'jh_else_ce/lib/utils/url_utility';
import { FORUM_URL, PROMO_URL } from 'jh_else_ce/lib/utils/url_utility';
import { useLocalStorageSpy } from 'helpers/local_storage_helper';
import { STORAGE_KEY } from '~/whats_new/utils/notification';
import { helpCenterState } from '~/super_sidebar/constants';
......@@ -53,7 +53,7 @@ describe('HelpCenter component', () => {
},
{
text: HelpCenter.i18n.docs,
href: DOCS_URL,
href: sidebarData.docs_path,
extraAttrs: trackingAttrs('gitlab_documentation'),
},
{
......@@ -68,7 +68,7 @@ describe('HelpCenter component', () => {
},
{
text: HelpCenter.i18n.contribute,
href: helpPagePath('', { anchor: 'contributing-to-gitlab' }),
href: helpPagePath('', { anchor: 'contribute-to-gitlab' }),
extraAttrs: trackingAttrs('contribute_to_gitlab'),
},
{
......
......@@ -102,6 +102,7 @@ export const sidebarData = {
projects_path: 'path/to/projects',
groups_path: 'path/to/groups',
support_path: '/support',
docs_path: '/help/docs',
display_whats_new: true,
whats_new_most_recent_release_items_count: 5,
whats_new_version_digest: 1,
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册