Commit 31307c8b authored by Igor Drozdov's avatar Igor Drozdov

Merge branch 'fix-open-sse-on-subgroups' into 'master'

Static Site Editor can’t be opened in projects belonging to a subgroup

See merge request gitlab-org/gitlab!35378
parents 4aca628f b897ddcb
---
title: 'Static Site Editor can’t be opened in projects belonging to a subgroup'
merge_request: 35378
author:
type: fixed
......@@ -20,7 +20,7 @@ module Gitlab
commit_id: commit_id,
project_id: project.id,
project: project.path,
namespace: project.namespace.path,
namespace: project.namespace.full_path,
return_url: sanitize_url(return_url),
is_supported_content: supported_content?.to_s,
base_url: Gitlab::Routing.url_helpers.project_show_sse_path(project, full_path)
......
......@@ -6,7 +6,10 @@ RSpec.describe Gitlab::StaticSiteEditor::Config do
subject(:config) { described_class.new(repository, ref, file_path, return_url) }
let_it_be(:namespace) { create(:namespace, name: 'namespace') }
let_it_be(:root_group) { create(:group, name: 'group') }
let_it_be(:subgroup) { create(:group, name: 'subgroup', parent: root_group) }
let_it_be(:project) { create(:project, :public, :repository, name: 'project', namespace: namespace) }
let_it_be(:project_with_subgroup) { create(:project, :public, :repository, name: 'project', group: subgroup) }
let_it_be(:repository) { project.repository }
let(:ref) { 'master' }
......@@ -30,6 +33,18 @@ RSpec.describe Gitlab::StaticSiteEditor::Config do
)
end
context 'when namespace is a subgroup' do
let(:repository) { project_with_subgroup.repository }
it 'returns data for the frontend component' do
is_expected.to include(
namespace: 'group/subgroup',
project: 'project',
base_url: '/group/subgroup/project/-/sse/master%2FREADME.md'
)
end
end
context 'when file has .md.erb extension' do
let(:file_path) { 'README.md.erb' }
......
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