Commit 60848600 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '325729-admin-count-doesn-t-include-minimal-access-users' into 'master'

Count minimal access users in admin area group page [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!57630
parents 6a96e3a5 9022a50a
......@@ -126,7 +126,7 @@
.card
.card-header
= html_escape(_("%{group_name} group members")) % { group_name: "<strong>#{html_escape(@group.name)}</strong>".html_safe }
%span.badge.badge-pill= @group.members.size
%span.badge.badge-pill= @group.users_count
.float-right
= link_to group_group_members_path(@group), class: 'btn btn-default gl-button btn-sm' do
= sprite_icon('pencil-square', css_class: 'gl-icon')
......
......@@ -431,7 +431,7 @@ module EE
override :users_count
def users_count
return all_group_members.count unless minimal_access_role_allowed?
return all_group_members.count if minimal_access_role_allowed?
members.count
end
......
---
title: Count minimal access users in admin area group page
merge_request: 57630
author:
type: fixed
......@@ -765,6 +765,35 @@ RSpec.describe Group do
end
end
describe '#users_count' do
subject { group.users_count }
let(:group) { create(:group) }
let(:user) { create(:user) }
context 'with `minimal_access_role` not licensed' do
before do
stub_licensed_features(minimal_access_role: false)
create(:group_member, :minimal_access, user: user, source: group)
end
it 'does not count the minimal access user' do
expect(group.users_count).to eq(0)
end
end
context 'with `minimal_access_role` licensed' do
before do
stub_licensed_features(minimal_access_role: true)
create(:group_member, :minimal_access, user: user, source: group)
end
it 'counts the minimal access user' do
expect(group.users_count).to eq(1)
end
end
end
describe '#saml_discovery_token' do
it 'returns existing tokens' do
group = create(:group, saml_discovery_token: 'existing')
......
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