Commit cc2f3a8c authored by Sean McGivern's avatar Sean McGivern

Merge branch '342177-promote-invite-members-dropdown' into 'master'

Make invite members in quick menu permanent

See merge request gitlab-org/gitlab!74760
parents f4da99f5 74e014e6
...@@ -50,7 +50,7 @@ module Nav ...@@ -50,7 +50,7 @@ module Nav
menu_items.push(create_epic_menu_item(group)) menu_items.push(create_epic_menu_item(group))
if Gitlab::Experimentation.active?(:invite_members_new_dropdown) && can?(current_user, :admin_group_member, group) if can?(current_user, :admin_group_member, group)
menu_items.push( menu_items.push(
invite_members_menu_item( invite_members_menu_item(
href: group_group_members_path(group) href: group_group_members_path(group)
...@@ -101,7 +101,7 @@ module Nav ...@@ -101,7 +101,7 @@ module Nav
) )
end end
if Gitlab::Experimentation.active?(:invite_members_new_dropdown) && can_admin_project_member?(project) if can_admin_project_member?(project)
menu_items.push( menu_items.push(
invite_members_menu_item( invite_members_menu_item(
href: project_project_members_path(project) href: project_project_members_path(project)
...@@ -161,12 +161,11 @@ module Nav ...@@ -161,12 +161,11 @@ module Nav
::Gitlab::Nav::TopNavMenuItem.build( ::Gitlab::Nav::TopNavMenuItem.build(
id: 'invite', id: 'invite',
title: s_('InviteMember|Invite members'), title: s_('InviteMember|Invite members'),
emoji: ('shaking_hands' if experiment_enabled?(:invite_members_new_dropdown)), emoji: 'shaking_hands',
href: href, href: href,
data: { data: {
track_action: 'click_link', track_action: 'click_link_invite_members',
track_label: tracking_label, track_label: 'plus_menu_dropdown'
track_property: experiment_tracking_category_and_group(:invite_members_new_dropdown)
} }
) )
end end
......
---
name: invite_members_new_dropdown_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50069
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/291
milestone: '13.8'
type: experiment
group: group::expansion
default_enabled: false
...@@ -37,9 +37,6 @@ module Gitlab ...@@ -37,9 +37,6 @@ module Gitlab
remove_known_trial_form_fields_noneditable: { remove_known_trial_form_fields_noneditable: {
tracking_category: 'Growth::Conversion::Experiment::RemoveKnownTrialFormFieldsNoneditable', tracking_category: 'Growth::Conversion::Experiment::RemoveKnownTrialFormFieldsNoneditable',
rollout_strategy: :user rollout_strategy: :user
},
invite_members_new_dropdown: {
tracking_category: 'Growth::Expansion::Experiment::InviteMembersNewDropdown'
} }
}.freeze }.freeze
......
...@@ -16,7 +16,7 @@ module Gitlab ...@@ -16,7 +16,7 @@ module Gitlab
included do included do
before_action :set_experimentation_subject_id_cookie, unless: :dnt_enabled? before_action :set_experimentation_subject_id_cookie, unless: :dnt_enabled?
helper_method :experiment_enabled?, :experiment_tracking_category_and_group, :record_experiment_group, :tracking_label helper_method :experiment_enabled?, :experiment_tracking_category_and_group, :record_experiment_group
end end
def set_experimentation_subject_id_cookie def set_experimentation_subject_id_cookie
......
...@@ -13,8 +13,6 @@ RSpec.describe Nav::NewDropdownHelper do ...@@ -13,8 +13,6 @@ RSpec.describe Nav::NewDropdownHelper do
let(:with_can_create_project) { false } let(:with_can_create_project) { false }
let(:with_can_create_group) { false } let(:with_can_create_group) { false }
let(:with_can_create_snippet) { false } let(:with_can_create_snippet) { false }
let(:with_invite_members_experiment) { false }
let(:with_invite_members_experiment_enabled) { false }
let(:subject) { helper.new_dropdown_view_model(project: current_project, group: current_group) } let(:subject) { helper.new_dropdown_view_model(project: current_project, group: current_group) }
...@@ -28,11 +26,6 @@ RSpec.describe Nav::NewDropdownHelper do ...@@ -28,11 +26,6 @@ RSpec.describe Nav::NewDropdownHelper do
end end
before do before do
allow(::Gitlab::Experimentation).to receive(:active?).with(:invite_members_new_dropdown) { with_invite_members_experiment }
allow(helper).to receive(:experiment_enabled?).with(:invite_members_new_dropdown) { with_invite_members_experiment_enabled }
allow(helper).to receive(:tracking_label) { 'test_tracking_label' }
allow(helper).to receive(:experiment_tracking_category_and_group) { |x| x }
allow(helper).to receive(:current_user) { current_user } allow(helper).to receive(:current_user) { current_user }
allow(helper).to receive(:can?) { false } allow(helper).to receive(:can?) { false }
...@@ -42,38 +35,23 @@ RSpec.describe Nav::NewDropdownHelper do ...@@ -42,38 +35,23 @@ RSpec.describe Nav::NewDropdownHelper do
end end
shared_examples 'invite member link shared example' do shared_examples 'invite member link shared example' do
it 'shows invite member link' do it 'shows invite member link with emoji' do
expect(subject[:menu_sections]).to eq( expect(subject[:menu_sections]).to eq(
expected_menu_section( expected_menu_section(
title: expected_title, title: expected_title,
menu_item: ::Gitlab::Nav::TopNavMenuItem.build( menu_item: ::Gitlab::Nav::TopNavMenuItem.build(
id: 'invite', id: 'invite',
title: 'Invite members', title: 'Invite members',
emoji: 'shaking_hands',
href: expected_href, href: expected_href,
data: { data: {
track_action: 'click_link', track_action: 'click_link_invite_members',
track_label: 'test_tracking_label', track_label: 'plus_menu_dropdown'
track_property: :invite_members_new_dropdown
} }
) )
) )
) )
end end
context 'with experiment enabled' do
let(:with_invite_members_experiment_enabled) { true }
it 'shows emoji with invite member link' do
expect(subject[:menu_sections]).to match(
expected_menu_section(
title: expected_title,
menu_item: a_hash_including(
emoji: 'shaking_hands'
)
)
)
end
end
end end
it 'has title' do it 'has title' do
......
...@@ -6,33 +6,13 @@ RSpec.describe 'layouts/header/_new_dropdown' do ...@@ -6,33 +6,13 @@ RSpec.describe 'layouts/header/_new_dropdown' do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
shared_examples_for 'invite member quick link' do shared_examples_for 'invite member quick link' do
context 'when an experiment is active' do context 'with ability to invite members' do
before do it { is_expected.to have_link('Invite members', href: href) }
allow(Gitlab::Experimentation).to receive(:active?).and_return(true)
allow(view).to receive(:experiment_tracking_category_and_group)
allow(view).to receive(:tracking_label)
end
context 'with ability to invite members' do
it { is_expected.to have_link('Invite members', href: href) }
it 'records the experiment' do
subject
expect(view).to have_received(:experiment_tracking_category_and_group)
.with(:invite_members_new_dropdown)
expect(view).to have_received(:tracking_label)
end
end
context 'without ability to invite members' do
let(:invite_member) { false }
it { is_expected.not_to have_link('Invite members') }
end
end end
context 'when experiment is not active' do context 'without ability to invite members' do
let(:invite_member) { false }
it { is_expected.not_to have_link('Invite members') } it { is_expected.not_to have_link('Invite members') }
end end
end end
...@@ -72,7 +52,6 @@ RSpec.describe 'layouts/header/_new_dropdown' do ...@@ -72,7 +52,6 @@ RSpec.describe 'layouts/header/_new_dropdown' do
allow(view).to receive(:can?).with(user, :create_projects, group).and_return(true) allow(view).to receive(:can?).with(user, :create_projects, group).and_return(true)
allow(view).to receive(:can?).with(user, :admin_group_member, group).and_return(invite_member) allow(view).to receive(:can?).with(user, :admin_group_member, group).and_return(invite_member)
allow(view).to receive(:can_admin_project_member?).and_return(invite_member) allow(view).to receive(:can_admin_project_member?).and_return(invite_member)
allow(view).to receive(:experiment_enabled?)
end end
subject do subject do
......
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