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
protected
def render_show_html
record_experiment_user(:invite_members_empty_group_version_a) if ::Gitlab.com?
render 'groups/show', locals: { trial: params[:trial] }
end
......
......@@ -18,4 +18,8 @@ module InviteMembersHelper
experiment_enabled?(:invite_members_version_b) && !can_import_members?
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
......@@ -6,6 +6,7 @@
= render 'dashboard/groups_head'
- if params[:filter].blank? && @groups.empty?
= render 'shared/groups/empty_state'
.empty-state
= render 'shared/groups/empty_state'
- else
= render 'groups'
.group-empty-state.row.align-items-center.justify-content-center
.icon.text-center.order-md-2
.row.gl-align-items-center.gl-justify-content-center
.order-md-2
= 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.")
%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.")
- 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
invite_members_version_b: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersVersionB'
},
invite_members_empty_group_version_a: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersEmptyGroupVersionA'
},
new_create_project_ui: {
tracking_category: 'Manage::Import::Experiment::NewCreateProjectUi'
},
......
......@@ -14425,6 +14425,9 @@ msgstr ""
msgid "Invite teammates (optional)"
msgstr ""
msgid "Invite your team"
msgstr ""
msgid "InviteEmail|%{inviter} invited you to join the %{project_or_group_name} %{project_or_group} as a %{role}"
msgstr ""
......
......@@ -7,70 +7,110 @@ RSpec.describe InviteMembersHelper do
let_it_be(:developer) { create(:user, developer_projects: [project]) }
let(:owner) { project.owner }
before do
assign(:project, project)
end
context 'with project' do
before do
assign(:project, project)
end
describe "#directly_invite_members?" do
context 'when the user is an owner' do
before do
allow(helper).to receive(:current_user) { owner }
end
describe "#directly_invite_members?" do
context 'when the user is an owner' do
before do
allow(helper).to receive(:current_user) { owner }
end
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { false }
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { false }
expect(helper.directly_invite_members?).to eq 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
it 'returns true' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { true }
context 'when the user is a developer' do
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
context 'when the user is a developer' do
before do
allow(helper).to receive(:current_user) { developer }
describe "#indirectly_invite_members?" do
context 'when a user is a developer' do
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
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_a) { true }
context 'when a user is an owner' do
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
describe "#indirectly_invite_members?" do
context 'when a user is a developer' do
before do
allow(helper).to receive(:current_user) { developer }
end
context 'with group' do
let_it_be(:group) { create(:group) }
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { false }
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
expect(helper.indirectly_invite_members?).to eq false
end
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_empty_group_version_a) { false }
it 'returns true' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { true }
expect(helper.invite_group_members?(group)).to eq false
end
expect(helper.indirectly_invite_members?).to eq true
end
end
it 'returns true' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_empty_group_version_a) { true }
context 'when a user is an owner' do
before do
allow(helper).to receive(:current_user) { owner }
expect(helper.invite_group_members?(group)).to eq true
end
end
it 'returns false' do
allow(helper).to receive(:experiment_enabled?).with(:invite_members_version_b) { true }
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.indirectly_invite_members?).to eq false
expect(helper.invite_group_members?(group)).to eq false
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