Commit 8cf126bf authored by Matthias Käppler's avatar Matthias Käppler

Merge branch 'add-invite-team-in-product-marketing-email' into 'master'

Create email message encouraging group creator to invite their teammates

See merge request gitlab-org/gitlab!72849
parents d2b6fdbc d82b6abe
......@@ -166,10 +166,11 @@
= about_link('mailers/in_product_marketing/gitlab-logo-gray-rgb.png', 200)
%tr
%td{ "aria-hidden" => "true", height: "30", style: "font-size: 0; line-height: 0;" }
%tr{ style: "background-color: #ffffff;" }
%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" }
%p
= @message.progress.html_safe
- if @message.series?
%tr{ style: "background-color: #ffffff;" }
%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" }
%p
= @message.progress.html_safe
%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%" }
= inline_image_link(@message.logo_path, { width: '150', style: 'width: 150px;' })
......
......@@ -7,7 +7,8 @@ module Gitlab
UnknownTrackError = Class.new(StandardError)
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
end
......
......@@ -12,12 +12,12 @@ module Gitlab
attr_accessor :format
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
@user = user
@series = series
@format = format
validate_series!
end
def subject_line
......@@ -115,6 +115,10 @@ module Gitlab
["mailers/in_product_marketing", "#{track}-#{series}.png"].join('/')
end
def series?
total_series > 0
end
protected
attr_reader :group, :user, :series
......@@ -171,6 +175,12 @@ module Gitlab
e.run
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
......
# 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 ""
msgid "InProductMarketing|GitHub Enterprise projects to GitLab"
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."
msgstr ""
......@@ -17679,6 +17682,15 @@ msgstr ""
msgid "InProductMarketing|Invite your team today to build better code (and processes) together"
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"
msgstr ""
......
......@@ -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) }
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
# 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
context 'when track exists' do
where(:track, :expected_class) do
:create | described_class::Create
:verify | described_class::Verify
:trial | described_class::Trial
:team | described_class::Team
:create | described_class::Create
:team_short | described_class::TeamShort
:trial_short | described_class::TrialShort
: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
with_them do
......
......@@ -63,6 +63,7 @@ RSpec.describe Emails::InProductMarketing do
:team_short | 0
:trial_short | 0
:admin_verify | 0
:invite_team | 0
end
with_them 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(CGI.unescapeHTML(message.invite_link))
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
......
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