Commit 464302e2 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'add-invite-user-track-to-onboarding-emails' into 'master'

Add team_short track to in-product marketing emails

See merge request gitlab-org/gitlab!66854
parents 9d18bd71 6f38ab40
......@@ -40,7 +40,7 @@ class Groups::EmailCampaignsController < Groups::ApplicationController
project_pipelines_url(group.projects.first)
when :trial
'https://about.gitlab.com/free-trial/'
when :team
when :team, :team_short
group_group_members_url(group)
end
end
......
......@@ -19,7 +19,8 @@ module Users
verify: 1,
trial: 2,
team: 3,
experience: 4
experience: 4,
team_short: 5
}, _suffix: true
scope :without_track_and_series, -> (track, series) do
......
......@@ -8,8 +8,13 @@ module Namespaces
completed_actions: [:created],
incomplete_actions: [:git_write]
},
team_short: {
interval_days: [1],
completed_actions: [:git_write],
incomplete_actions: [:user_added]
},
verify: {
interval_days: [1, 5, 10],
interval_days: [2, 6, 11],
completed_actions: [:git_write],
incomplete_actions: [:pipeline_created]
},
......@@ -98,13 +103,11 @@ module Namespaces
def can_perform_action?(user, group)
case track
when :create
user.can?(:create_projects, group)
when :verify
when :create, :verify
user.can?(:create_projects, group)
when :trial
user.can?(:start_trial, group)
when :team
when :team, :team_short
user.can?(:admin_group_member, group)
when :experience
true
......
---
key_path: counts.in_product_marketing_email_team_short_0_cta_clicked
name: "count_clicks_on_the_first_email_of_the_team_short_track_for_in_product_marketing_emails"
description: Total clicks on the team_short track's first email
product_section:
product_stage: growth
product_group: group::activation
product_category: onboarding
value_type: number
status: implemented
milestone: "14.2"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66854
time_frame: all
data_source: database
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
---
key_path: counts.in_product_marketing_email_team_short_0_sent
name: "count_sent_first_email_of_the_team_short_track_for_in_product_marketing_emails"
description: Total sent emails of the team_short track's first email
product_section:
product_stage: growth
product_group: group::activation
product_category: onboarding
value_type: number
status: implemented
milestone: "14.2"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66854
time_frame: all
data_source: database
data_category: Optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
......@@ -2638,6 +2638,34 @@ Status: `data_available`
Tiers: `free`, `premium`, `ultimate`
### `counts.in_product_marketing_email_team_short_0_cta_clicked`
Total clicks on the team_short track's first email
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210727095918_in_product_marketing_email_team_short_0_cta_clicked.yml)
Group: `group::activation`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.in_product_marketing_email_team_short_0_sent`
Total sent emails of the team_short track's first email
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210727095923_in_product_marketing_email_team_short_0_sent.yml)
Group: `group::activation`
Data Category: `Optional`
Status: `implemented`
Tiers: `free`, `premium`, `ultimate`
### `counts.in_product_marketing_email_trial_0_cta_clicked`
Total clicks on the verify trial's first email
......
......@@ -67,11 +67,11 @@ module Gitlab
end
end
def progress
def progress(current: series + 1, total: total_series, track_name: track.to_s.humanize)
if Gitlab.com?
s_('InProductMarketing|This is email %{current_series} of %{total_series} in the %{track} series.') % { current_series: series + 1, total_series: total_series, track: track.to_s.humanize }
s_('InProductMarketing|This is email %{current_series} of %{total_series} in the %{track} series.') % { current_series: current, total_series: total, track: track_name }
else
s_('InProductMarketing|This is email %{current_series} of %{total_series} in the %{track} series. To disable notification emails sent by your local GitLab instance, either contact your administrator or %{unsubscribe_link}.') % { current_series: series + 1, total_series: total_series, track: track.to_s.humanize, unsubscribe_link: unsubscribe_link }
s_('InProductMarketing|This is email %{current_series} of %{total_series} in the %{track} series. To disable notification emails sent by your local GitLab instance, either contact your administrator or %{unsubscribe_link}.') % { current_series: current, total_series: total, track: track_name, unsubscribe_link: unsubscribe_link }
end
end
......@@ -109,7 +109,7 @@ module Gitlab
private
def track
self.class.name.demodulize.downcase.to_sym
self.class.name.demodulize.underscore.to_sym
end
def total_series
......
......@@ -73,6 +73,10 @@ module Gitlab
s_('InProductMarketing|Invite your team now')
][series]
end
def progress
super(current: series + 2, total: 4)
end
end
end
end
......
# frozen_string_literal: true
module Gitlab
module Email
module Message
module InProductMarketing
class TeamShort < Base
def subject_line
s_('InProductMarketing|Team up in GitLab for greater efficiency')
end
def tagline
nil
end
def title
s_('InProductMarketing|Turn coworkers into collaborators')
end
def subtitle
s_('InProductMarketing|Invite your team today to build better code (and processes) together')
end
def body_line1
''
end
def body_line2
''
end
def cta_text
s_('InProductMarketing|Invite your colleagues today')
end
def progress
super(total: 4, track_name: 'Team')
end
def logo_path
'mailers/in_product_marketing/team-0.png'
end
end
end
end
end
end
......@@ -17001,6 +17001,9 @@ msgstr ""
msgid "InProductMarketing|Invite your team now"
msgstr ""
msgid "InProductMarketing|Invite your team today to build better code (and processes) together"
msgstr ""
msgid "InProductMarketing|It's all in the stats"
msgstr ""
......@@ -17082,6 +17085,9 @@ msgstr ""
msgid "InProductMarketing|Take your source code management to the next level"
msgstr ""
msgid "InProductMarketing|Team up in GitLab for greater efficiency"
msgstr ""
msgid "InProductMarketing|Team work makes the dream work"
msgstr ""
......@@ -17118,6 +17124,9 @@ msgstr ""
msgid "InProductMarketing|Try it yourself"
msgstr ""
msgid "InProductMarketing|Turn coworkers into collaborators"
msgstr ""
msgid "InProductMarketing|Twitter"
msgstr ""
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Email::Message::InProductMarketing::TeamShort do
using RSpec::Parameterized::TableSyntax
let_it_be(:group) { build(:group) }
let_it_be(:user) { build(:user) }
let(:series) { 0 }
subject(:message) { described_class.new(group: group, user: user, series: series)}
describe 'public methods' do
it 'returns value for series', :aggregate_failures do
expect(message.subject_line).to eq 'Team up in GitLab for greater efficiency'
expect(message.tagline).to be_nil
expect(message.title).to eq 'Turn coworkers into collaborators'
expect(message.subtitle).to eq 'Invite your team today to build better code (and processes) together'
expect(message.body_line1).to be_empty
expect(message.body_line2).to be_empty
expect(message.cta_text).to eq 'Invite your colleagues today'
expect(message.logo_path).to eq 'mailers/in_product_marketing/team-0.png'
end
describe '#progress' do
subject { message.progress }
before do
allow(Gitlab).to receive(:com?).and_return(is_gitlab_com)
end
context 'on gitlab.com' do
let(:is_gitlab_com) { true }
it { is_expected.to include('This is email 1 of 4 in the Team series') }
end
context 'not on gitlab.com' do
let(:is_gitlab_com) { false }
it { is_expected.to include('This is email 1 of 4 in the Team series', Gitlab::Routing.url_helpers.profile_notifications_url) }
end
end
end
end
......@@ -23,6 +23,26 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Team do
expect(message.body_line2).to be_present
expect(message.cta_text).to be_present
end
describe '#progress' do
subject { message.progress }
before do
allow(Gitlab).to receive(:com?).and_return(is_gitlab_com)
end
context 'on gitlab.com' do
let(:is_gitlab_com) { true }
it { is_expected.to include("This is email #{series + 2} of 4 in the Team series") }
end
context 'not on gitlab.com' do
let(:is_gitlab_com) { false }
it { is_expected.to include("This is email #{series + 2} of 4 in the Team series", Gitlab::Routing.url_helpers.profile_notifications_url) }
end
end
end
context 'with series 2' do
......@@ -37,6 +57,26 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Team do
expect(message.body_line2).to be_present
expect(message.cta_text).to be_present
end
describe '#progress' do
subject { message.progress }
before do
allow(Gitlab).to receive(:com?).and_return(is_gitlab_com)
end
context 'on gitlab.com' do
let(:is_gitlab_com) { true }
it { is_expected.to include('This is email 4 of 4 in the Team series') }
end
context 'not on gitlab.com' do
let(:is_gitlab_com) { false }
it { is_expected.to include('This is email 4 of 4 in the Team series', Gitlab::Routing.url_helpers.profile_notifications_url) }
end
end
end
end
end
......@@ -1359,6 +1359,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
"in_product_marketing_email_create_1_cta_clicked" => -1,
"in_product_marketing_email_create_2_sent" => -1,
"in_product_marketing_email_create_2_cta_clicked" => -1,
"in_product_marketing_email_team_short_0_sent" => -1,
"in_product_marketing_email_team_short_0_cta_clicked" => -1,
"in_product_marketing_email_verify_0_sent" => -1,
"in_product_marketing_email_verify_0_cta_clicked" => -1,
"in_product_marketing_email_verify_1_sent" => -1,
......@@ -1398,6 +1400,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
"in_product_marketing_email_create_1_cta_clicked" => 0,
"in_product_marketing_email_create_2_sent" => 0,
"in_product_marketing_email_create_2_cta_clicked" => 0,
"in_product_marketing_email_team_short_0_sent" => 0,
"in_product_marketing_email_team_short_0_cta_clicked" => 0,
"in_product_marketing_email_verify_0_sent" => 1,
"in_product_marketing_email_verify_0_cta_clicked" => 0,
"in_product_marketing_email_verify_1_sent" => 0,
......
......@@ -19,6 +19,12 @@ RSpec.describe Users::InProductMarketingEmail, type: :model do
it { is_expected.to validate_uniqueness_of(:user_id).scoped_to([:track, :series]).with_message('has already been sent') }
end
describe '.tracks' do
it 'has an entry for every track' do
expect(Namespaces::InProductMarketingEmailsService::TRACKS.keys).to match_array(described_class.tracks.keys.map(&:to_sym))
end
end
describe '.without_track_and_series' do
let_it_be(:user) { create(:user) }
......
......@@ -42,9 +42,10 @@ RSpec.describe Namespaces::InProductMarketingEmailsService, '#execute' do
:create | 1 | { created_at: frozen_time - 2.days }
:create | 5 | { created_at: frozen_time - 6.days }
:create | 10 | { created_at: frozen_time - 11.days }
:verify | 1 | { created_at: frozen_time - 2.days, git_write_at: frozen_time - 2.days }
:verify | 5 | { created_at: frozen_time - 6.days, git_write_at: frozen_time - 6.days }
:verify | 10 | { created_at: frozen_time - 11.days, git_write_at: frozen_time - 11.days }
:team_short | 1 | { created_at: frozen_time - 2.days, git_write_at: frozen_time - 2.days }
:verify | 2 | { created_at: frozen_time - 3.days, git_write_at: frozen_time - 3.days }
:verify | 6 | { created_at: frozen_time - 7.days, git_write_at: frozen_time - 7.days }
:verify | 11 | { created_at: frozen_time - 12.days, git_write_at: frozen_time - 12.days }
:trial | 1 | { created_at: frozen_time - 2.days, git_write_at: frozen_time - 2.days, pipeline_created_at: frozen_time - 2.days }
:trial | 5 | { created_at: frozen_time - 6.days, git_write_at: frozen_time - 6.days, pipeline_created_at: frozen_time - 6.days }
:trial | 10 | { created_at: frozen_time - 11.days, git_write_at: frozen_time - 11.days, pipeline_created_at: frozen_time - 11.days }
......@@ -60,14 +61,14 @@ RSpec.describe Namespaces::InProductMarketingEmailsService, '#execute' do
end
context 'when initialized with a different track' do
let(:track) { :verify }
let(:track) { :team_short }
it { is_expected.not_to send_in_product_marketing_email }
context 'when the previous track actions have been completed' do
let(:current_action_completed_at) { frozen_time - 2.days }
it { is_expected.to send_in_product_marketing_email(user.id, group.id, :verify, 0) }
it { is_expected.to send_in_product_marketing_email(user.id, group.id, track, 0) }
end
end
......@@ -168,7 +169,7 @@ RSpec.describe Namespaces::InProductMarketingEmailsService, '#execute' do
subject
expect(Notify).to have_received(:in_product_marketing_email).with(user.id, group.id, :create, 0)
expect(Notify).to have_received(:in_product_marketing_email).with(user.id, other_group.id, :verify, 0)
expect(Notify).to have_received(:in_product_marketing_email).with(user.id, other_group.id, :team_short, 0)
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