diff --git a/app/views/notify/in_product_marketing_email.html.haml b/app/views/notify/in_product_marketing_email.html.haml index 575e967d5f8582fa0cbd876d94a837ee580be780..a85fa7c519f38886bf460e6e3aba88088cf8287e 100644 --- a/app/views/notify/in_product_marketing_email.html.haml +++ b/app/views/notify/in_product_marketing_email.html.haml @@ -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;' }) diff --git a/lib/gitlab/email/message/in_product_marketing.rb b/lib/gitlab/email/message/in_product_marketing.rb index fb4315e74b2b924e073476ab06a238c6c9e4430a..8843dafb53359aa6452dd26e3ee3aa5b8a51a8ed 100644 --- a/lib/gitlab/email/message/in_product_marketing.rb +++ b/lib/gitlab/email/message/in_product_marketing.rb @@ -7,7 +7,8 @@ module InProductMarketing 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 diff --git a/lib/gitlab/email/message/in_product_marketing/base.rb b/lib/gitlab/email/message/in_product_marketing/base.rb index 8c6583164bf914a0957ea571e0e4432e14bc2ff4..07e6c65ed0fe67a7b56f149f1d9b59ff65992ccf 100644 --- a/lib/gitlab/email/message/in_product_marketing/base.rb +++ b/lib/gitlab/email/message/in_product_marketing/base.rb @@ -12,12 +12,12 @@ class Base 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 @@ def logo_path ["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 @@ def invite_members_for_task_experiment_enabled? 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 diff --git a/lib/gitlab/email/message/in_product_marketing/invite_team.rb b/lib/gitlab/email/message/in_product_marketing/invite_team.rb new file mode 100644 index 0000000000000000000000000000000000000000..5db0660dc1485cb46bc3e0313b80034d1480eea7 --- /dev/null +++ b/lib/gitlab/email/message/in_product_marketing/invite_team.rb @@ -0,0 +1,47 @@ +# 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 diff --git a/locale/gitlab.pot b/locale/gitlab.pot index c6c00bedca352c9a2d42ab10f265b8b35a31c976..3f5d09ea5c3019361a3c00e504fb56202ec7f45c 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -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 "" diff --git a/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb index 277f1158f8b309d711b3314f055fd39af2aa42a1..0521123f1ef8746c40de0ad938dc40c8bee0c6e6 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb @@ -82,4 +82,29 @@ 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 diff --git a/spec/lib/gitlab/email/message/in_product_marketing/invite_team_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/invite_team_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..13377ee0cadb66a7ca7325f9e9bb40ee062131a2 --- /dev/null +++ b/spec/lib/gitlab/email/message/in_product_marketing/invite_team_spec.rb @@ -0,0 +1,21 @@ +# 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 diff --git a/spec/lib/gitlab/email/message/in_product_marketing_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing_spec.rb index 9ffc4a340a3f688600ebbe6d4deffc5192756640..594df7440bb765432048421319260d5164707dd0 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing_spec.rb @@ -10,10 +10,15 @@ 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 diff --git a/spec/mailers/emails/in_product_marketing_spec.rb b/spec/mailers/emails/in_product_marketing_spec.rb index c4ec4c84ff4341101eed799486ebc1b05c8acc11..3b92b049e425fa2a4fe589bc4afcfd68dcd235b3 100644 --- a/spec/mailers/emails/in_product_marketing_spec.rb +++ b/spec/mailers/emails/in_product_marketing_spec.rb @@ -63,6 +63,7 @@ :team_short | 0 :trial_short | 0 :admin_verify | 0 + :invite_team | 0 end with_them do @@ -92,6 +93,12 @@ 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