Commit cf97630e authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'fj-include-only-owned-groups-in-sitemap' into 'master'

Include only Gitlab-org owned groups in sitemap

See merge request gitlab-org/gitlab!47608
parents 67b6e388 928c135b
---
title: Include only Gitlab-org owned groups in sitemap
merge_request: 47608
author:
type: changed
...@@ -56,7 +56,7 @@ module Gitlab ...@@ -56,7 +56,7 @@ module Gitlab
current_user: nil, current_user: nil,
group: gitlab_org_group, group: gitlab_org_group,
params: { non_archived: true }, params: { non_archived: true },
options: { include_subgroups: true } options: { include_subgroups: true, only_owned: true }
).execute.include_project_feature.inc_routes ).execute.include_project_feature.inc_routes
end end
end end
......
...@@ -40,8 +40,11 @@ RSpec.describe Gitlab::Sitemaps::Generator do ...@@ -40,8 +40,11 @@ RSpec.describe Gitlab::Sitemaps::Generator do
let_it_be(:public_subgroup_internal_project) { create(:project, :internal, namespace: public_subgroup) } let_it_be(:public_subgroup_internal_project) { create(:project, :internal, namespace: public_subgroup) }
let_it_be(:internal_subgroup_private_project) { create(:project, :private, namespace: internal_subgroup) } let_it_be(:internal_subgroup_private_project) { create(:project, :private, namespace: internal_subgroup) }
let_it_be(:internal_subgroup_internal_project) { create(:project, :internal, namespace: internal_subgroup) } let_it_be(:internal_subgroup_internal_project) { create(:project, :internal, namespace: internal_subgroup) }
let_it_be(:other_project) { create(:project, :public) }
it 'includes default explore routes and gitlab-org group routes' do it 'includes default explore routes and gitlab-org group routes' do
create(:project_group_link, project: other_project, group: gitlab_org_group)
content = subject.render content = subject.render
expect(content).to include('/explore/projects') expect(content).to include('/explore/projects')
...@@ -55,6 +58,7 @@ RSpec.describe Gitlab::Sitemaps::Generator do ...@@ -55,6 +58,7 @@ RSpec.describe Gitlab::Sitemaps::Generator do
expect(content).not_to include(internal_gitlab_org_project.full_path) expect(content).not_to include(internal_gitlab_org_project.full_path)
expect(content).not_to include(private_gitlab_org_project.full_path) expect(content).not_to include(private_gitlab_org_project.full_path)
expect(content).not_to include(internal_subgroup.full_path) expect(content).not_to include(internal_subgroup.full_path)
expect(content).not_to include(other_project.full_path)
expect(content).not_to include(public_subgroup_internal_project.full_path) expect(content).not_to include(public_subgroup_internal_project.full_path)
expect(content).not_to include(internal_subgroup_private_project.full_path) expect(content).not_to include(internal_subgroup_private_project.full_path)
expect(content).not_to include(internal_subgroup_internal_project.full_path) expect(content).not_to include(internal_subgroup_internal_project.full_path)
......
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