Commit 43a4aadf authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch...

Merge branch '219239-experiment-add-an-invite-team-members-cta-to-the-group-empty-state' into 'master'

Add an "Invite team members" CTA to the group empty state

See merge request gitlab-org/gitlab!45689
parents fc5bcea0 d4bf55ba
...@@ -193,6 +193,8 @@ class GroupsController < Groups::ApplicationController ...@@ -193,6 +193,8 @@ class GroupsController < Groups::ApplicationController
protected protected
def render_show_html def render_show_html
record_experiment_user(:invite_members_empty_group_version_a) if ::Gitlab.com?
render 'groups/show', locals: { trial: params[:trial] } render 'groups/show', locals: { trial: params[:trial] }
end end
......
...@@ -18,4 +18,8 @@ module InviteMembersHelper ...@@ -18,4 +18,8 @@ module InviteMembersHelper
experiment_enabled?(:invite_members_version_b) && !can_import_members? experiment_enabled?(:invite_members_version_b) && !can_import_members?
end end
end end
def invite_group_members?(group)
experiment_enabled?(:invite_members_empty_group_version_a) && Ability.allowed?(current_user, :admin_group_member, group)
end
end end
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
= render 'dashboard/groups_head' = render 'dashboard/groups_head'
- if params[:filter].blank? && @groups.empty? - if params[:filter].blank? && @groups.empty?
.empty-state
= render 'shared/groups/empty_state' = render 'shared/groups/empty_state'
- else - else
= render 'groups' = render 'groups'
.group-empty-state.row.align-items-center.justify-content-center .row.gl-align-items-center.gl-justify-content-center
.icon.text-center.order-md-2 .order-md-2
= custom_icon("icon_empty_groups") = custom_icon("icon_empty_groups")
.text-content.m-0.order-md-1 .text-content.order-md-1{ class: 'gl-m-0!' }
%h4= s_("GroupsEmptyState|A group is a collection of several projects.") %h4= s_("GroupsEmptyState|A group is a collection of several projects.")
%p= s_("GroupsEmptyState|If you organize your projects under a group, it works like a folder.") %p= s_("GroupsEmptyState|If you organize your projects under a group, it works like a folder.")
%p= s_("GroupsEmptyState|You can manage your group member’s permissions and access to each project in the group.") %p= s_("GroupsEmptyState|You can manage your group member’s permissions and access to each project in the group.")
- if invite_group_members?(@group)
= link_to _('Invite your team'),
group_group_members_path(@group),
class: 'gl-button btn btn-success-secondary',
data: { track_event: 'click_invite_team_group_empty_state', track_label: 'invite_team_group_empty_state' }
...@@ -51,6 +51,9 @@ module Gitlab ...@@ -51,6 +51,9 @@ module Gitlab
invite_members_version_b: { invite_members_version_b: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersVersionB' tracking_category: 'Growth::Expansion::Experiment::InviteMembersVersionB'
}, },
invite_members_empty_group_version_a: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersEmptyGroupVersionA'
},
new_create_project_ui: { new_create_project_ui: {
tracking_category: 'Manage::Import::Experiment::NewCreateProjectUi' tracking_category: 'Manage::Import::Experiment::NewCreateProjectUi'
}, },
......
...@@ -14425,6 +14425,9 @@ msgstr "" ...@@ -14425,6 +14425,9 @@ msgstr ""
msgid "Invite teammates (optional)" msgid "Invite teammates (optional)"
msgstr "" msgstr ""
msgid "Invite your team"
msgstr ""
msgid "InviteEmail|%{inviter} invited you to join the %{project_or_group_name} %{project_or_group} as a %{role}" msgid "InviteEmail|%{inviter} invited you to join the %{project_or_group_name} %{project_or_group} as a %{role}"
msgstr "" msgstr ""
......
...@@ -7,6 +7,7 @@ RSpec.describe InviteMembersHelper do ...@@ -7,6 +7,7 @@ RSpec.describe InviteMembersHelper do
let_it_be(:developer) { create(:user, developer_projects: [project]) } let_it_be(:developer) { create(:user, developer_projects: [project]) }
let(:owner) { project.owner } let(:owner) { project.owner }
context 'with project' do
before do before do
assign(:project, project) assign(:project, project)
end end
...@@ -74,4 +75,43 @@ RSpec.describe InviteMembersHelper do ...@@ -74,4 +75,43 @@ RSpec.describe InviteMembersHelper do
end end
end end
end end
end
context 'with group' do
let_it_be(:group) { create(:group) }
describe "#invite_group_members?" do
context 'when the user is an owner' do
before do
group.add_owner(owner)
allow(helper).to receive(:current_user) { owner }
end
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_empty_group_version_a) { false }
expect(helper.invite_group_members?(group)).to eq false
end
it 'returns true' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_empty_group_version_a) { true }
expect(helper.invite_group_members?(group)).to eq true
end
end
context 'when the user is a developer' do
before do
group.add_developer(developer)
allow(helper).to receive(:current_user) { developer }
end
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_empty_group_version_a) { true }
expect(helper.invite_group_members?(group)).to eq false
end
end
end
end
end end
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