Commit 979206a8 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'cleanup-invitation-reminders-experiment' into 'master'

Cleanup invitation_reminders experiment code

See merge request gitlab-org/gitlab!47920
parents 00112e67 f9623ecc
......@@ -20,7 +20,6 @@ class InvitesController < ApplicationController
def accept
if member.accept_invite!(current_user)
track_invitation_reminders_experiment('accepted')
redirect_to invite_details[:path], notice: _("You have been granted %{member_human_access} access to %{title} %{name}.") %
{ member_human_access: member.human_access, title: invite_details[:title], name: invite_details[:name] }
else
......@@ -107,8 +106,4 @@ class InvitesController < ApplicationController
}
end
end
def track_invitation_reminders_experiment(action)
track_experiment_event(:invitation_reminders, action, subject: member)
end
end
......@@ -63,15 +63,6 @@ module Emails
subject: subject_line,
layout: 'unknown_user_mailer'
)
if Gitlab::Experimentation.active?(:invitation_reminders)
Gitlab::Tracking.event(
Gitlab::Experimentation.get_experiment(:invitation_reminders).tracking_category,
'sent',
property: Gitlab::Experimentation.in_experiment_group?(:invitation_reminders, subject: member.invite_email) ? 'experimental_group' : 'control_group',
label: Digest::MD5.hexdigest(member.to_global_id.to_s)
)
end
end
def member_invited_reminder_email(member_source_type, member_id, token, reminder_index)
......
......@@ -14,8 +14,6 @@ module Members
end
def execute
return unless experiment_enabled?
reminder_index = days_on_which_to_send_reminders.index(days_after_invitation_sent)
return unless reminder_index
......@@ -24,10 +22,6 @@ module Members
private
def experiment_enabled?
Gitlab::Experimentation.in_experiment_group?(:invitation_reminders, subject: invitation.invite_email)
end
def days_after_invitation_sent
(Date.today - invitation.created_at.to_date).to_i
end
......
......@@ -8,8 +8,6 @@ class MemberInvitationReminderEmailsWorker # rubocop:disable Scalability/Idempot
urgency :low
def perform
return unless Gitlab::Experimentation.active?(:invitation_reminders)
Member.not_accepted_invitations.not_expired.last_ten_days_excluding_today.find_in_batches do |invitations|
invitations.each do |invitation|
Members::InvitationReminderEmailService.new(invitation).execute
......
---
title: Add invitation reminders
merge_request: 47920
author:
type: added
......@@ -96,6 +96,9 @@ invitation, change their access level, or even delete them.
![Invite user members list](img/add_user_email_accept.png)
While unaccepted, the system will automatically send reminder emails on the second, fifth,
and tenth day after the invitation was initially sent.
After the user accepts the invitation, they are prompted to create a new
GitLab account using the same e-mail address the invitation was sent to.
......
......@@ -66,10 +66,6 @@ module Gitlab
tracking_category: 'Growth::Acquisition::Experiment::InviteEmail',
use_backwards_compatible_subject_index: true
},
invitation_reminders: {
tracking_category: 'Growth::Acquisition::Experiment::InvitationReminders',
use_backwards_compatible_subject_index: true
},
group_only_trials: {
tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials',
use_backwards_compatible_subject_index: true
......
......@@ -22,43 +22,6 @@ RSpec.describe InvitesController, :snowplow do
end
end
shared_examples "tracks the 'accepted' event for the invitation reminders experiment" do
before do
stub_experiment(invitation_reminders: true)
stub_experiment_for_subject(invitation_reminders: experimental_group)
end
context 'when in the control group' do
let(:experimental_group) { false }
it "tracks the 'accepted' event" do
request
expect_snowplow_event(
category: 'Growth::Acquisition::Experiment::InvitationReminders',
label: md5_member_global_id,
property: 'control_group',
action: 'accepted'
)
end
end
context 'when in the experimental group' do
let(:experimental_group) { true }
it "tracks the 'accepted' event" do
request
expect_snowplow_event(
category: 'Growth::Acquisition::Experiment::InvitationReminders',
label: md5_member_global_id,
property: 'experimental_group',
action: 'accepted'
)
end
end
end
describe 'GET #show' do
subject(:request) { get :show, params: params }
......@@ -87,7 +50,6 @@ RSpec.describe InvitesController, :snowplow do
expect(flash[:notice]).to be_nil
end
it_behaves_like "tracks the 'accepted' event for the invitation reminders experiment"
it_behaves_like 'invalid token'
end
......@@ -119,7 +81,6 @@ RSpec.describe InvitesController, :snowplow do
subject(:request) { post :accept, params: params }
it_behaves_like "tracks the 'accepted' event for the invitation reminders experiment"
it_behaves_like 'invalid token'
end
......
......@@ -16,7 +16,6 @@ RSpec.describe Gitlab::Experimentation::EXPERIMENTS do
:contact_sales_btn_in_app,
:customize_homepage,
:invite_email,
:invitation_reminders,
:group_only_trials,
:default_to_issues_board
]
......
......@@ -1450,38 +1450,6 @@ RSpec.describe Notify do
subject { described_class.member_invited_email('Group', group_member.id, group_member.invite_token) }
shared_examples "tracks the 'sent' event for the invitation reminders experiment" do
before do
stub_experiment(invitation_reminders: true)
allow(Gitlab::Experimentation).to receive(:in_experiment_group?).with(:invitation_reminders, subject: group_member.invite_email).and_return(experimental_group)
end
it "tracks the 'sent' event", :snowplow do
subject.deliver_now
expect_snowplow_event(
category: 'Growth::Acquisition::Experiment::InvitationReminders',
label: Digest::MD5.hexdigest(group_member.to_global_id.to_s),
property: experimental_group ? 'experimental_group' : 'control_group',
action: 'sent'
)
end
end
describe 'tracking for the invitation reminders experiment' do
context 'when invite email is in the experimental group' do
let(:experimental_group) { true }
it_behaves_like "tracks the 'sent' event for the invitation reminders experiment"
end
context 'when invite email is in the control group' do
let(:experimental_group) { false }
it_behaves_like "tracks the 'sent' event for the invitation reminders experiment"
end
end
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
it_behaves_like "a user cannot unsubscribe through footer link"
......
......@@ -9,24 +9,7 @@ RSpec.describe Members::InvitationReminderEmailService do
let_it_be(:frozen_time) { Date.today.beginning_of_day }
let_it_be(:invitation) { build(:group_member, :invited, created_at: frozen_time) }
context 'when the experiment is disabled' do
before do
allow(Gitlab::Experimentation).to receive(:in_experiment_group?).and_return(false)
invitation.expires_at = frozen_time + 2.days
end
it 'does not send an invitation' do
travel_to(frozen_time + 1.day) do
expect(invitation).not_to receive(:send_invitation_reminder)
subject
end
end
end
context 'when the experiment is enabled' do
before do
allow(Gitlab::Experimentation).to receive(:in_experiment_group?).and_return(true)
invitation.expires_at = frozen_time + expires_at_days.days if expires_at_days
end
......@@ -74,5 +57,4 @@ RSpec.describe Members::InvitationReminderEmailService do
end
end
end
end
end
......@@ -10,23 +10,6 @@ RSpec.describe MemberInvitationReminderEmailsWorker do
create(:group_member, :invited, created_at: 2.days.ago)
end
context 'feature flag disabled' do
before do
stub_experiment(invitation_reminders: false)
end
it 'does not attempt to execute the invitation reminder service' do
expect(Members::InvitationReminderEmailService).not_to receive(:new)
subject
end
end
context 'feature flag enabled' do
before do
stub_experiment(invitation_reminders: true)
end
it 'executes the invitation reminder email service' do
expect_next_instance_of(Members::InvitationReminderEmailService) do |service|
expect(service).to receive(:execute)
......@@ -35,5 +18,4 @@ RSpec.describe MemberInvitationReminderEmailsWorker do
subject
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