Commit 7dadf9b8 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'if-36639-remove_share_group_with_group_feature_flag' into 'master'

Remove share_group_with_group feature flag

Closes #36639

See merge request gitlab-org/gitlab!31077
parents e4c2209d 8d5607a8
# frozen_string_literal: true # frozen_string_literal: true
class Groups::GroupLinksController < Groups::ApplicationController class Groups::GroupLinksController < Groups::ApplicationController
before_action :check_feature_flag!
before_action :authorize_admin_group! before_action :authorize_admin_group!
before_action :group_link, only: [:update, :destroy] before_action :group_link, only: [:update, :destroy]
...@@ -51,8 +50,4 @@ class Groups::GroupLinksController < Groups::ApplicationController ...@@ -51,8 +50,4 @@ class Groups::GroupLinksController < Groups::ApplicationController
def group_link_params def group_link_params
params.require(:group_link).permit(:group_access, :expires_at) params.require(:group_link).permit(:group_access, :expires_at)
end end
def check_feature_flag!
render_404 unless Feature.enabled?(:share_group_with_group, default_enabled: true)
end
end end
...@@ -509,8 +509,6 @@ class Group < Namespace ...@@ -509,8 +509,6 @@ class Group < Namespace
end end
def max_member_access_for_user_from_shared_groups(user) def max_member_access_for_user_from_shared_groups(user)
return unless Feature.enabled?(:share_group_with_group, default_enabled: true)
group_group_link_table = GroupGroupLink.arel_table group_group_link_table = GroupGroupLink.arel_table
group_member_table = GroupMember.arel_table group_member_table = GroupMember.arel_table
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
= _("Group members") = _("Group members")
%hr %hr
- if can_manage_members - if can_manage_members
- if Feature.enabled?(:share_group_with_group, default_enabled: true)
%ul.nav-links.nav.nav-tabs.gitlab-tabs{ role: 'tablist' } %ul.nav-links.nav.nav-tabs.gitlab-tabs{ role: 'tablist' }
%li.nav-tab{ role: 'presentation' } %li.nav-tab{ role: 'presentation' }
%a.nav-link.active{ href: '#invite-member-pane', id: 'invite-member-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite member") %a.nav-link.active{ href: '#invite-member-pane', id: 'invite-member-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite member")
...@@ -18,11 +17,8 @@ ...@@ -18,11 +17,8 @@
.tab-content.gitlab-tab-content .tab-content.gitlab-tab-content
.tab-pane.active{ id: 'invite-member-pane', role: 'tabpanel' } .tab-pane.active{ id: 'invite-member-pane', role: 'tabpanel' }
= render_invite_member_for_group(@group, @group_member.access_level) = render_invite_member_for_group(@group, @group_member.access_level)
- if Feature.enabled?(:share_group_with_group, default_enabled: true)
.tab-pane{ id: 'invite-group-pane', role: 'tabpanel' } .tab-pane{ id: 'invite-group-pane', role: 'tabpanel' }
= render 'shared/members/invite_group', submit_url: group_group_links_path(@group), access_levels: GroupMember.access_level_roles, default_access_level: @group_member.access_level, group_link_field: 'shared_with_group_id', group_access_field: 'shared_group_access' = render 'shared/members/invite_group', submit_url: group_group_links_path(@group), access_levels: GroupMember.access_level_roles, default_access_level: @group_member.access_level, group_link_field: 'shared_with_group_id', group_access_field: 'shared_group_access'
- else
= render_invite_member_for_group(@group, @group_member.access_level)
= render 'shared/members/requests', membership_source: @group, requesters: @requesters = render 'shared/members/requests', membership_source: @group, requesters: @requesters
......
...@@ -412,14 +412,10 @@ module EE ...@@ -412,14 +412,10 @@ module EE
# Members belonging to Groups invited to collaborate with Groups and Subgroups # Members belonging to Groups invited to collaborate with Groups and Subgroups
def billed_shared_group_members def billed_shared_group_members
return ::GroupMember.none unless ::Feature.enabled?(:share_group_with_group)
invited_or_shared_group_members(invited_group_in_groups) invited_or_shared_group_members(invited_group_in_groups)
end end
def billed_shared_non_guests_group_members def billed_shared_non_guests_group_members
return ::GroupMember.none unless ::Feature.enabled?(:share_group_with_group)
invited_or_shared_group_members(invited_non_guest_group_in_groups) invited_or_shared_group_members(invited_non_guest_group_in_groups)
end end
......
...@@ -965,22 +965,6 @@ describe Namespace do ...@@ -965,22 +965,6 @@ describe Namespace do
shared_group: group }) shared_group: group })
end end
context 'when feature is not enabled' do
before do
stub_feature_flags(share_group_with_group: false)
end
it 'does not include users coming from the shared groups', :aggregate_failures do
expect(group.billed_user_ids).to match_array([developer.id])
expect(shared_group.billed_user_ids).not_to include([developer.id])
end
end
context 'when feature is enabled' do
before do
stub_feature_flags(share_group_with_group: true)
end
it 'includes active users from the shared group to the billed members', :aggregate_failures do it 'includes active users from the shared group to the billed members', :aggregate_failures do
expect(group.billed_user_ids).to match_array([shared_group_developer.id, developer.id]) expect(group.billed_user_ids).to match_array([shared_group_developer.id, developer.id])
expect(shared_group.billed_user_ids).not_to include([developer.id]) expect(shared_group.billed_user_ids).not_to include([developer.id])
...@@ -1024,7 +1008,6 @@ describe Namespace do ...@@ -1024,7 +1008,6 @@ describe Namespace do
end end
end end
end end
end
context 'with other plans' do context 'with other plans' do
%i[bronze_plan silver_plan].each do |plan| %i[bronze_plan silver_plan].each do |plan|
...@@ -1089,21 +1072,6 @@ describe Namespace do ...@@ -1089,21 +1072,6 @@ describe Namespace do
shared_group: group }) shared_group: group })
end end
context 'when feature is not enabled' do
before do
stub_feature_flags(share_group_with_group: false)
end
it 'does not include users coming from the shared groups' do
expect(group.billed_user_ids).to match_array([developer.id, guest.id])
end
end
context 'when feature is enabled' do
before do
stub_feature_flags(share_group_with_group: true)
end
it 'includes active users from the shared group including guests', :aggregate_failures do it 'includes active users from the shared group including guests', :aggregate_failures do
expect(group.billed_user_ids).to match_array([developer.id, guest.id, shared_group_developer.id, shared_group_guest.id]) expect(group.billed_user_ids).to match_array([developer.id, guest.id, shared_group_developer.id, shared_group_guest.id])
expect(shared_group.billed_user_ids).to match_array([shared_group_developer.id, shared_group_guest.id]) expect(shared_group.billed_user_ids).to match_array([shared_group_developer.id, shared_group_guest.id])
...@@ -1113,7 +1081,6 @@ describe Namespace do ...@@ -1113,7 +1081,6 @@ describe Namespace do
end end
end end
end end
end
describe '#billable_members_count' do describe '#billable_members_count' do
context 'with a user namespace' do context 'with a user namespace' do
...@@ -1186,27 +1153,11 @@ describe Namespace do ...@@ -1186,27 +1153,11 @@ describe Namespace do
shared_group: group }) shared_group: group })
end end
context 'when feature is not enabled' do
before do
stub_feature_flags(share_group_with_group: false)
end
it 'does not include users coming from the shared groups' do
expect(group.billable_members_count).to eq(1)
end
end
context 'when feature is enabled' do
before do
stub_feature_flags(share_group_with_group: true)
end
it 'includes active users from the shared group to the billed members count' do it 'includes active users from the shared group to the billed members count' do
expect(group.billable_members_count).to eq(2) expect(group.billable_members_count).to eq(2)
end end
end end
end end
end
context 'with other plans' do context 'with other plans' do
%i[bronze_plan silver_plan].each do |plan| %i[bronze_plan silver_plan].each do |plan|
...@@ -1260,21 +1211,6 @@ describe Namespace do ...@@ -1260,21 +1211,6 @@ describe Namespace do
shared_group: group }) shared_group: group })
end end
context 'when feature is not enabled' do
before do
stub_feature_flags(share_group_with_group: false)
end
it 'does not include users coming from the shared groups' do
expect(group.billable_members_count).to eq(2)
end
end
context 'when feature is enabled' do
before do
stub_feature_flags(share_group_with_group: true)
end
it 'includes active users from the shared group including guests to the billed members count' do it 'includes active users from the shared group including guests to the billed members count' do
expect(group.billable_members_count).to eq(4) expect(group.billable_members_count).to eq(4)
end end
...@@ -1283,7 +1219,6 @@ describe Namespace do ...@@ -1283,7 +1219,6 @@ describe Namespace do
end end
end end
end end
end
describe '#file_template_project_id' do describe '#file_template_project_id' do
it 'is cleared before validation' do it 'is cleared before validation' do
......
...@@ -99,18 +99,6 @@ describe Groups::GroupLinksController do ...@@ -99,18 +99,6 @@ describe Groups::GroupLinksController do
expect(flash[:alert]).to eq('error') expect(flash[:alert]).to eq('error')
end end
end end
context 'when feature flag is disabled' do
before do
stub_feature_flags(share_group_with_group: false)
end
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end end
context 'when user does not have access to the group' do context 'when user does not have access to the group' do
...@@ -184,18 +172,6 @@ describe Groups::GroupLinksController do ...@@ -184,18 +172,6 @@ describe Groups::GroupLinksController do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
context 'when feature flag is disabled' do
before do
stub_feature_flags(share_group_with_group: false)
end
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end end
describe '#destroy' do describe '#destroy' do
...@@ -231,17 +207,5 @@ describe Groups::GroupLinksController do ...@@ -231,17 +207,5 @@ describe Groups::GroupLinksController do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
context 'when feature flag is disabled' do
before do
stub_feature_flags(share_group_with_group: false)
end
it 'renders 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end end
end end
...@@ -15,11 +15,6 @@ describe 'Groups > Members > Manage groups', :js do ...@@ -15,11 +15,6 @@ describe 'Groups > Members > Manage groups', :js do
sign_in(user) sign_in(user)
end end
context 'with share groups with groups feature flag' do
before do
stub_feature_flags(shared_with_group: true)
end
it 'add group to group' do it 'add group to group' do
visit group_group_members_path(shared_group) visit group_group_members_path(shared_group)
...@@ -72,18 +67,4 @@ describe 'Groups > Members > Manage groups', :js do ...@@ -72,18 +67,4 @@ describe 'Groups > Members > Manage groups', :js do
click_button "Invite" click_button "Invite"
end end
end end
end
context 'without share groups with groups feature flag' do
before do
stub_feature_flags(share_group_with_group: false)
end
it 'does not render invitation form and tabs' do
visit group_group_members_path(shared_group)
expect(page).not_to have_link('Invite member')
expect(page).not_to have_link('Invite group')
end
end
end end
...@@ -555,11 +555,6 @@ describe Group do ...@@ -555,11 +555,6 @@ describe Group do
group_access: GroupMember::DEVELOPER }) group_access: GroupMember::DEVELOPER })
end end
context 'when feature flag share_group_with_group is enabled' do
before do
stub_feature_flags(share_group_with_group: true)
end
context 'with user in the group' do context 'with user in the group' do
let(:user) { group_user } let(:user) { group_user }
...@@ -630,43 +625,6 @@ describe Group do ...@@ -630,43 +625,6 @@ describe Group do
end end
end end
context 'when feature flag share_group_with_group is disabled' do
before do
stub_feature_flags(share_group_with_group: false)
end
context 'with user in the group' do
let(:user) { group_user }
it 'returns correct access level' do
expect(shared_group_parent.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
expect(shared_group.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
expect(shared_group_child.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
end
end
context 'with user in the parent group' do
let(:user) { parent_group_user }
it 'returns correct access level' do
expect(shared_group_parent.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
expect(shared_group.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
expect(shared_group_child.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
end
end
context 'with user in the child group' do
let(:user) { child_group_user }
it 'returns correct access level' do
expect(shared_group_parent.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
expect(shared_group.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
expect(shared_group_child.max_member_access_for_user(user)).to eq(Gitlab::Access::NO_ACCESS)
end
end
end
end
context 'multiple groups shared with group' do context 'multiple groups shared with group' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:group) { create(:group, :private) } let(:group) { create(:group, :private) }
...@@ -674,8 +632,6 @@ describe Group do ...@@ -674,8 +632,6 @@ describe Group do
let(:shared_group) { create(:group, :private, parent: shared_group_parent) } let(:shared_group) { create(:group, :private, parent: shared_group_parent) }
before do before do
stub_feature_flags(share_group_with_group: true)
group.add_owner(user) group.add_owner(user)
create(:group_group_link, { shared_with_group: group, create(:group_group_link, { shared_with_group: group,
......
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