Commit 57cc0fda authored by Sean McGivern's avatar Sean McGivern

Merge branch '339197-fj-linear-manageable-groups' into 'master'

Use linear version of User#manageable_groups

See merge request gitlab-org/gitlab!68845
parents 52828e6a f9818cfe
...@@ -1550,7 +1550,11 @@ class User < ApplicationRecord ...@@ -1550,7 +1550,11 @@ class User < ApplicationRecord
end end
def manageable_groups(include_groups_with_developer_maintainer_access: false) def manageable_groups(include_groups_with_developer_maintainer_access: false)
owned_and_maintainer_group_hierarchy = Gitlab::ObjectHierarchy.new(owned_or_maintainers_groups).base_and_descendants owned_and_maintainer_group_hierarchy = if Feature.enabled?(:linear_user_manageable_groups, self, default_enabled: :yaml)
owned_or_maintainers_groups.self_and_descendants
else
Gitlab::ObjectHierarchy.new(owned_or_maintainers_groups).base_and_descendants
end
if include_groups_with_developer_maintainer_access if include_groups_with_developer_maintainer_access
union_sql = ::Gitlab::SQL::Union.new( union_sql = ::Gitlab::SQL::Union.new(
......
---
name: linear_user_manageable_groups
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68845
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339434
milestone: '14.3'
type: development
group: group::access
default_enabled: false
...@@ -1755,6 +1755,7 @@ RSpec.describe User do ...@@ -1755,6 +1755,7 @@ RSpec.describe User do
end end
describe '#manageable_groups' do describe '#manageable_groups' do
shared_examples 'manageable groups examples' do
it 'includes all the namespaces the user can manage' do it 'includes all the namespaces the user can manage' do
expect(user.manageable_groups).to contain_exactly(group, subgroup) expect(user.manageable_groups).to contain_exactly(group, subgroup)
end end
...@@ -1766,6 +1767,17 @@ RSpec.describe User do ...@@ -1766,6 +1767,17 @@ RSpec.describe User do
end end
end end
it_behaves_like 'manageable groups examples'
context 'when feature flag :linear_user_manageable_groups is disabled' do
before do
stub_feature_flags(linear_user_manageable_groups: false)
end
it_behaves_like 'manageable groups examples'
end
end
describe '#manageable_groups_with_routes' do describe '#manageable_groups_with_routes' do
it 'eager loads routes from manageable groups' do it 'eager loads routes from manageable groups' do
control_count = control_count =
......
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