Commit d82b6abe authored by eugielimpin's avatar eugielimpin

Add email to encourage group creator to invite their teammates

Add Gitlab::Email::Message::InProductMarketingEmail::InviteTeam. This
email message is sent to a group creator 20 minutes after they create
the group to encourage them to invite their teammates.
parent a2d053e6
...@@ -166,10 +166,11 @@ ...@@ -166,10 +166,11 @@
= about_link('mailers/in_product_marketing/gitlab-logo-gray-rgb.png', 200) = about_link('mailers/in_product_marketing/gitlab-logo-gray-rgb.png', 200)
%tr %tr
%td{ "aria-hidden" => "true", height: "30", style: "font-size: 0; line-height: 0;" } %td{ "aria-hidden" => "true", height: "30", style: "font-size: 0; line-height: 0;" }
%tr{ style: "background-color: #ffffff;" } - if @message.series?
%td{ style: "color: #424242; padding: 10px 30px; text-align: center; font-family: 'Source Sans Pro', helvetica, arial, sans-serif;font-size: 16px; line-height: 22px; border: 1px solid #dddddd" } %tr{ style: "background-color: #ffffff;" }
%p %td{ style: "color: #424242; padding: 10px 30px; text-align: center; font-family: 'Source Sans Pro', helvetica, arial, sans-serif;font-size: 16px; line-height: 22px; border: 1px solid #dddddd" }
= @message.progress.html_safe %p
= @message.progress.html_safe
%tr %tr
%td{ bgcolor: "#ffffff", height: "auto", style: "max-width: 600px; width: 100%; text-align: center; height: 200px; padding: 25px 15px; mso-line-height-rule: exactly; min-height: 40px; font-family: 'Source Sans Pro', helvetica, arial, sans-serif;", valign: "middle", width: "100%" } %td{ bgcolor: "#ffffff", height: "auto", style: "max-width: 600px; width: 100%; text-align: center; height: 200px; padding: 25px 15px; mso-line-height-rule: exactly; min-height: 40px; font-family: 'Source Sans Pro', helvetica, arial, sans-serif;", valign: "middle", width: "100%" }
= inline_image_link(@message.logo_path, { width: '150', style: 'width: 150px;' }) = inline_image_link(@message.logo_path, { width: '150', style: 'width: 150px;' })
......
...@@ -7,7 +7,8 @@ module Gitlab ...@@ -7,7 +7,8 @@ module Gitlab
UnknownTrackError = Class.new(StandardError) UnknownTrackError = Class.new(StandardError)
def self.for(track) def self.for(track)
raise UnknownTrackError unless Namespaces::InProductMarketingEmailsService::TRACKS.key?(track) valid_tracks = [:invite_team, Namespaces::InProductMarketingEmailsService::TRACKS.keys].flatten
raise UnknownTrackError unless valid_tracks.include?(track)
"Gitlab::Email::Message::InProductMarketing::#{track.to_s.classify}".constantize "Gitlab::Email::Message::InProductMarketing::#{track.to_s.classify}".constantize
end end
......
...@@ -12,12 +12,12 @@ module Gitlab ...@@ -12,12 +12,12 @@ module Gitlab
attr_accessor :format attr_accessor :format
def initialize(group:, user:, series:, format: :html) def initialize(group:, user:, series:, format: :html)
raise ArgumentError, "Only #{total_series} series available for this track." unless series.between?(0, total_series - 1) @series = series
@group = group @group = group
@user = user @user = user
@series = series
@format = format @format = format
validate_series!
end end
def subject_line def subject_line
...@@ -115,6 +115,10 @@ module Gitlab ...@@ -115,6 +115,10 @@ module Gitlab
["mailers/in_product_marketing", "#{track}-#{series}.png"].join('/') ["mailers/in_product_marketing", "#{track}-#{series}.png"].join('/')
end end
def series?
total_series > 0
end
protected protected
attr_reader :group, :user, :series attr_reader :group, :user, :series
...@@ -171,6 +175,12 @@ module Gitlab ...@@ -171,6 +175,12 @@ module Gitlab
e.run e.run
end end
end end
def validate_series!
return unless series?
raise ArgumentError, "Only #{total_series} series available for this track." unless @series.between?(0, total_series - 1)
end
end end
end end
end end
......
# frozen_string_literal: true
module Gitlab
module Email
module Message
module InProductMarketing
class InviteTeam < Base
def subject_line
s_('InProductMarketing|Invite your teammates to GitLab')
end
def tagline
''
end
def title
s_('InProductMarketing|GitLab is better with teammates to help out!')
end
def subtitle
''
end
def body_line1
s_('InProductMarketing|Invite your teammates today and build better code together. You can even assign tasks to new teammates such as setting up CI/CD, to help get projects up and running.')
end
def body_line2
''
end
def cta_text
s_('InProductMarketing|Invite your teammates to help')
end
def logo_path
'mailers/in_product_marketing/team-0.png'
end
def series?
false
end
end
end
end
end
end
...@@ -17604,6 +17604,9 @@ msgstr "" ...@@ -17604,6 +17604,9 @@ msgstr ""
msgid "InProductMarketing|GitHub Enterprise projects to GitLab" msgid "InProductMarketing|GitHub Enterprise projects to GitLab"
msgstr "" msgstr ""
msgid "InProductMarketing|GitLab is better with teammates to help out!"
msgstr ""
msgid "InProductMarketing|GitLab provides static application security testing (SAST), dynamic application security testing (DAST), container scanning, and dependency scanning to help you deliver secure applications along with license compliance." msgid "InProductMarketing|GitLab provides static application security testing (SAST), dynamic application security testing (DAST), container scanning, and dependency scanning to help you deliver secure applications along with license compliance."
msgstr "" msgstr ""
...@@ -17679,6 +17682,15 @@ msgstr "" ...@@ -17679,6 +17682,15 @@ msgstr ""
msgid "InProductMarketing|Invite your team today to build better code (and processes) together" msgid "InProductMarketing|Invite your team today to build better code (and processes) together"
msgstr "" msgstr ""
msgid "InProductMarketing|Invite your teammates to GitLab"
msgstr ""
msgid "InProductMarketing|Invite your teammates to help"
msgstr ""
msgid "InProductMarketing|Invite your teammates today and build better code together. You can even assign tasks to new teammates such as setting up CI/CD, to help get projects up and running."
msgstr ""
msgid "InProductMarketing|It's all in the stats" msgid "InProductMarketing|It's all in the stats"
msgstr "" msgstr ""
......
...@@ -82,4 +82,29 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Base do ...@@ -82,4 +82,29 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Base do
it { is_expected.to include('This is email 1 of 3 in the Create series', Gitlab::Routing.url_helpers.profile_notifications_url) } it { is_expected.to include('This is email 1 of 3 in the Create series', Gitlab::Routing.url_helpers.profile_notifications_url) }
end end
end end
describe '#series?' do
using RSpec::Parameterized::TableSyntax
subject do
test_class = "Gitlab::Email::Message::InProductMarketing::#{track.to_s.classify}".constantize
test_class.new(group: group, user: user, series: series).series?
end
where(:track, :result) do
:create | true
:team_short | true
:trial_short | true
:admin_verify | true
:verify | true
:trial | true
:team | true
:experience | true
:invite_team | false
end
with_them do
it { is_expected.to eq result }
end
end
end end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Email::Message::InProductMarketing::InviteTeam do
let_it_be(:group) { build(:group) }
let_it_be(:user) { build(:user) }
subject(:message) { described_class.new(group: group, user: user, series: 0) }
it 'contains the correct message', :aggregate_failures do
expect(message.subject_line).to eq 'Invite your teammates to GitLab'
expect(message.tagline).to be_empty
expect(message.title).to eq 'GitLab is better with teammates to help out!'
expect(message.subtitle).to be_empty
expect(message.body_line1).to eq 'Invite your teammates today and build better code together. You can even assign tasks to new teammates such as setting up CI/CD, to help get projects up and running.'
expect(message.body_line2).to be_empty
expect(message.cta_text).to eq 'Invite your teammates to help'
expect(message.logo_path).to eq 'mailers/in_product_marketing/team-0.png'
end
end
...@@ -10,10 +10,15 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing do ...@@ -10,10 +10,15 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing do
context 'when track exists' do context 'when track exists' do
where(:track, :expected_class) do where(:track, :expected_class) do
:create | described_class::Create :create | described_class::Create
:verify | described_class::Verify :team_short | described_class::TeamShort
:trial | described_class::Trial :trial_short | described_class::TrialShort
:team | described_class::Team :admin_verify | described_class::AdminVerify
:verify | described_class::Verify
:trial | described_class::Trial
:team | described_class::Team
:experience | described_class::Experience
:invite_team | described_class::InviteTeam
end end
with_them do with_them do
......
...@@ -63,6 +63,7 @@ RSpec.describe Emails::InProductMarketing do ...@@ -63,6 +63,7 @@ RSpec.describe Emails::InProductMarketing do
:team_short | 0 :team_short | 0
:trial_short | 0 :trial_short | 0
:admin_verify | 0 :admin_verify | 0
:invite_team | 0
end end
with_them do with_them do
...@@ -92,6 +93,12 @@ RSpec.describe Emails::InProductMarketing do ...@@ -92,6 +93,12 @@ RSpec.describe Emails::InProductMarketing do
is_expected.not_to have_body_text(message.invite_text) is_expected.not_to have_body_text(message.invite_text)
is_expected.not_to have_body_text(CGI.unescapeHTML(message.invite_link)) is_expected.not_to have_body_text(CGI.unescapeHTML(message.invite_link))
end end
if track == :invite_team
is_expected.not_to have_body_text(/This is email \d of \d/)
else
is_expected.to have_body_text(message.progress)
end
end end
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