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?
= render 'shared/groups/empty_state' .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,70 +7,110 @@ RSpec.describe InviteMembersHelper do ...@@ -7,70 +7,110 @@ 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 }
before do context 'with project' do
assign(:project, project) before do
end assign(:project, project)
end
describe "#directly_invite_members?" do describe "#directly_invite_members?" do
context 'when the user is an owner' do context 'when the user is an owner' do
before do before do
allow(helper).to receive(:current_user) { owner } allow(helper).to receive(:current_user) { owner }
end end
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { false }
it 'returns false' do expect(helper.directly_invite_members?).to eq false
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { false } end
expect(helper.directly_invite_members?).to eq false it 'returns true' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { true }
expect(helper.directly_invite_members?).to eq true
end
end end
it 'returns true' do context 'when the user is a developer' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { true } before do
allow(helper).to receive(:current_user) { developer }
end
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { true }
expect(helper.directly_invite_members?).to eq true expect(helper.directly_invite_members?).to eq false
end
end end
end end
context 'when the user is a developer' do describe "#indirectly_invite_members?" do
before do context 'when a user is a developer' do
allow(helper).to receive(:current_user) { developer } before do
allow(helper).to receive(:current_user) { developer }
end
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { false }
expect(helper.indirectly_invite_members?).to eq false
end
it 'returns true' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { true }
expect(helper.indirectly_invite_members?).to eq true
end
end end
it 'returns false' do context 'when a user is an owner' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { true } before do
allow(helper).to receive(:current_user) { owner }
end
expect(helper.directly_invite_members?).to eq false it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { true }
expect(helper.indirectly_invite_members?).to eq false
end
end end
end end
end end
describe "#indirectly_invite_members?" do context 'with group' do
context 'when a user is a developer' do let_it_be(:group) { create(:group) }
before do
allow(helper).to receive(:current_user) { developer }
end
it 'returns false' do describe "#invite_group_members?" do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { false } context 'when the user is an owner' do
before do
group.add_owner(owner)
allow(helper).to receive(:current_user) { owner }
end
expect(helper.indirectly_invite_members?).to eq false it 'returns false' do
end allow(helper).to receive(:experiment_enabled?).with(:invite_members_empty_group_version_a) { false }
it 'returns true' do expect(helper.invite_group_members?(group)).to eq false
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { true } end
expect(helper.indirectly_invite_members?).to eq true it 'returns true' do
end allow(helper).to receive(:experiment_enabled?).with(:invite_members_empty_group_version_a) { true }
end
context 'when a user is an owner' do expect(helper.invite_group_members?(group)).to eq true
before do end
allow(helper).to receive(:current_user) { owner }
end end
it 'returns false' do context 'when the user is a developer' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { true } 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.indirectly_invite_members?).to eq false expect(helper.invite_group_members?(group)).to eq false
end
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