Commit 3c76f5c2 authored by Doug Stull's avatar Doug Stull Committed by Aleksei Lipniagov

Remove invite email from experiment

parent d974af2d
...@@ -79,8 +79,6 @@ class InvitesController < ApplicationController ...@@ -79,8 +79,6 @@ class InvitesController < ApplicationController
if params[:experiment_name] == 'invite_email_preview_text' if params[:experiment_name] == 'invite_email_preview_text'
experiment(:invite_email_preview_text, actor: member).track(:join_clicked) experiment(:invite_email_preview_text, actor: member).track(:join_clicked)
elsif params[:experiment_name] == 'invite_email_from'
experiment(:invite_email_from, actor: member).track(:join_clicked)
end end
Gitlab::Tracking.event(self.class.name, 'join_clicked', label: 'invite_email', property: member.id.to_s) Gitlab::Tracking.event(self.class.name, 'join_clicked', label: 'invite_email', property: member.id.to_s)
......
...@@ -212,7 +212,6 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -212,7 +212,6 @@ class RegistrationsController < Devise::RegistrationsController
experiment_name = session.delete(:invite_email_experiment_name) experiment_name = session.delete(:invite_email_experiment_name)
experiment(:invite_email_preview_text, actor: member).track(:accepted) if experiment_name == 'invite_email_preview_text' experiment(:invite_email_preview_text, actor: member).track(:accepted) if experiment_name == 'invite_email_preview_text'
experiment(:invite_email_from, actor: member).track(:accepted) if experiment_name == 'invite_email_from'
Gitlab::Tracking.event(self.class.name, 'accepted', label: 'invite_email', property: member.id.to_s) Gitlab::Tracking.event(self.class.name, 'accepted', label: 'invite_email', property: member.id.to_s)
end end
......
...@@ -24,14 +24,7 @@ module NotifyHelper ...@@ -24,14 +24,7 @@ module NotifyHelper
def invited_join_url(token, member) def invited_join_url(token, member)
additional_params = { invite_type: Emails::Members::INITIAL_INVITE } additional_params = { invite_type: Emails::Members::INITIAL_INVITE }
# order important below to our scheduled testing of these if experiment(:invite_email_preview_text, actor: member).enabled?
# `from` experiment will be after the `text` on, but we may not cleanup
# from the `text` one by the time we run the `from` experiment,
# therefore we want to support `text` being fully enabled
# but if `from` is also enabled, then we only care about `from`
if experiment(:invite_email_from, actor: member).enabled?
additional_params[:experiment_name] = 'invite_email_from'
elsif experiment(:invite_email_preview_text, actor: member).enabled?
additional_params[:experiment_name] = 'invite_email_preview_text' additional_params[:experiment_name] = 'invite_email_preview_text'
end end
......
...@@ -61,7 +61,7 @@ module Emails ...@@ -61,7 +61,7 @@ module Emails
Gitlab::Tracking.event(self.class.name, 'invite_email_sent', label: 'invite_email', property: member_id.to_s) Gitlab::Tracking.event(self.class.name, 'invite_email_sent', label: 'invite_email', property: member_id.to_s)
mail(to: member.invite_email, subject: invite_email_subject, **invite_email_headers.merge(additional_invite_settings)) do |format| mail(to: member.invite_email, subject: invite_email_subject, **invite_email_headers) do |format|
format.html { render layout: 'unknown_user_mailer' } format.html { render layout: 'unknown_user_mailer' }
format.text { render layout: 'unknown_user_mailer' } format.text { render layout: 'unknown_user_mailer' }
end end
...@@ -151,17 +151,7 @@ module Emails ...@@ -151,17 +151,7 @@ module Emails
def invite_email_subject def invite_email_subject
if member.created_by if member.created_by
experiment(:invite_email_from, actor: member) do |experiment_instance| subject(s_("MemberInviteEmail|%{member_name} invited you to join GitLab") % { member_name: member.created_by.name })
experiment_instance.use do
subject(s_("MemberInviteEmail|%{member_name} invited you to join GitLab") % { member_name: member.created_by.name })
end
experiment_instance.candidate do
subject(s_("MemberInviteEmail|I've invited you to join me in GitLab"))
end
experiment_instance.run
end
else else
subject(s_("MemberInviteEmail|Invitation to join the %{project_or_group} %{project_or_group_name}") % { project_or_group: member_source.human_name, project_or_group_name: member_source.model_name.singular }) subject(s_("MemberInviteEmail|Invitation to join the %{project_or_group} %{project_or_group_name}") % { project_or_group: member_source.human_name, project_or_group_name: member_source.model_name.singular })
end end
...@@ -178,21 +168,6 @@ module Emails ...@@ -178,21 +168,6 @@ module Emails
end end
end end
def additional_invite_settings
return {} unless member.created_by
experiment(:invite_email_from, actor: member) do |experiment_instance|
experiment_instance.use { {} }
experiment_instance.candidate do
{
from: "#{member.created_by.name} <#{member.created_by.email}>"
}
end
experiment_instance.run
end
end
def member_exists? def member_exists?
Gitlab::AppLogger.info("Tried to send an email invitation for a deleted group. Member id: #{@member_id}") if member.blank? Gitlab::AppLogger.info("Tried to send an email invitation for a deleted group. Member id: #{@member_id}") if member.blank?
member.present? member.present?
......
---
name: invite_email_from
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68376
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/429
milestone: '14.3'
type: experiment
group: group::expansion
default_enabled: false
...@@ -21706,9 +21706,6 @@ msgstr "" ...@@ -21706,9 +21706,6 @@ msgstr ""
msgid "MemberInviteEmail|%{member_name} invited you to join GitLab" msgid "MemberInviteEmail|%{member_name} invited you to join GitLab"
msgstr "" msgstr ""
msgid "MemberInviteEmail|I've invited you to join me in GitLab"
msgstr ""
msgid "MemberInviteEmail|Invitation to join the %{project_or_group} %{project_or_group_name}" msgid "MemberInviteEmail|Invitation to join the %{project_or_group} %{project_or_group_name}"
msgstr "" msgstr ""
......
...@@ -120,29 +120,6 @@ RSpec.describe InvitesController do ...@@ -120,29 +120,6 @@ RSpec.describe InvitesController do
end end
end end
context 'when it is part of the invite_email_from experiment' do
let(:extra_params) { { invite_type: 'initial_email', experiment_name: 'invite_email_from' } }
it 'tracks the initial join click from email' do
experiment = double(track: true)
allow(controller).to receive(:experiment).with(:invite_email_from, actor: member).and_return(experiment)
request
expect(experiment).to have_received(:track).with(:join_clicked)
end
context 'when member does not exist' do
let(:raw_invite_token) { '_bogus_token_' }
it 'does not track the experiment' do
expect(controller).not_to receive(:experiment).with(:invite_email_from, actor: member)
request
end
end
end
context 'when member does not exist' do context 'when member does not exist' do
let(:raw_invite_token) { '_bogus_token_' } let(:raw_invite_token) { '_bogus_token_' }
...@@ -170,9 +147,8 @@ RSpec.describe InvitesController do ...@@ -170,9 +147,8 @@ RSpec.describe InvitesController do
end end
context 'when it is not part of our invite email experiment' do context 'when it is not part of our invite email experiment' do
it 'does not track via experiment', :aggregate_failures do it 'does not track via experiment' do
expect(controller).not_to receive(:experiment).with(:invite_email_preview_text, actor: member) expect(controller).not_to receive(:experiment).with(:invite_email_preview_text, actor: member)
expect(controller).not_to receive(:experiment).with(:invite_email_from, actor: member)
request request
end end
......
...@@ -227,40 +227,6 @@ RSpec.describe RegistrationsController do ...@@ -227,40 +227,6 @@ RSpec.describe RegistrationsController do
end end
end end
end end
context 'with the invite_email_preview_text experiment', :experiment do
let(:extra_session_params) { { invite_email_experiment_name: 'invite_email_from' } }
context 'when member and invite_email_experiment_name exists from the session key value' do
it 'tracks the invite acceptance' do
expect(experiment(:invite_email_from)).to track(:accepted)
.with_context(actor: member)
.on_next_instance
subject
end
end
context 'when member does not exist from the session key value' do
let(:originating_member_id) { -1 }
it 'does not track invite acceptance' do
expect(experiment(:invite_email_from)).not_to track(:accepted)
subject
end
end
context 'when invite_email_experiment_name does not exist from the session key value' do
let(:extra_session_params) { {} }
it 'does not track invite acceptance' do
expect(experiment(:invite_email_from)).not_to track(:accepted)
subject
end
end
end
end end
context 'when invite email matches email used on registration' do context 'when invite email matches email used on registration' do
......
...@@ -240,20 +240,6 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -240,20 +240,6 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end end
end end
context 'with invite email acceptance for the invite_email_from experiment', :experiment do
let(:extra_params) do
{ invite_type: Emails::Members::INITIAL_INVITE, experiment_name: 'invite_email_from' }
end
it 'tracks the accepted invite' do
expect(experiment(:invite_email_from)).to track(:accepted)
.with_context(actor: group_invite)
.on_next_instance
fill_in_sign_up_form(new_user)
end
end
it 'signs up and redirects to the group activity page with all the project/groups invitation automatically accepted' do it 'signs up and redirects to the group activity page with all the project/groups invitation automatically accepted' do
fill_in_sign_up_form(new_user) fill_in_sign_up_form(new_user)
fill_in_welcome_form fill_in_welcome_form
......
...@@ -70,28 +70,6 @@ RSpec.describe NotifyHelper do ...@@ -70,28 +70,6 @@ RSpec.describe NotifyHelper do
expect(helper.invited_join_url(token, member)) expect(helper.invited_join_url(token, member))
.to eq("http://test.host/-/invites/#{token}?experiment_name=invite_email_preview_text&invite_type=initial_email") .to eq("http://test.host/-/invites/#{token}?experiment_name=invite_email_preview_text&invite_type=initial_email")
end end
context 'when invite_email_from is enabled' do
before do
stub_experiments(invite_email_from: :control)
end
it 'has correct params' do
expect(helper.invited_join_url(token, member))
.to eq("http://test.host/-/invites/#{token}?experiment_name=invite_email_from&invite_type=initial_email")
end
end
end
context 'when invite_email_from is enabled' do
before do
stub_experiments(invite_email_from: :control)
end
it 'has correct params' do
expect(helper.invited_join_url(token, member))
.to eq("http://test.host/-/invites/#{token}?experiment_name=invite_email_from&invite_type=initial_email")
end
end end
context 'when invite_email_preview_text is disabled' do context 'when invite_email_preview_text is disabled' do
......
...@@ -888,27 +888,6 @@ RSpec.describe Notify do ...@@ -888,27 +888,6 @@ RSpec.describe Notify do
end end
end end
context 'with invite_email_from enabled', :experiment do
before do
stub_experiments(invite_email_from: :control)
end
it 'has the correct invite_url with params' do
is_expected.to have_link('Join now',
href: invite_url(project_member.invite_token,
invite_type: Emails::Members::INITIAL_INVITE,
experiment_name: 'invite_email_from'))
end
it 'tracks the sent invite' do
expect(experiment(:invite_email_from)).to track(:assignment)
.with_context(actor: project_member)
.on_next_instance
invite_email.deliver_now
end
end
context 'when invite email sent is tracked', :snowplow do context 'when invite email sent is tracked', :snowplow do
it 'tracks the sent invite' do it 'tracks the sent invite' do
invite_email.deliver_now invite_email.deliver_now
......
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