From 0ca9e9b7230cb262a04b524aee8ffe99dbe63060 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 22 Apr 2021 20:47:30 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-11-stable-ee --- .../javascripts/whats_new/utils/notification.js | 7 +--- app/helpers/in_product_marketing_helper.rb | 44 ++++++++++++++++++---- .../notify/in_product_marketing_email.html.haml | 10 ++--- .../notify/in_product_marketing_email.text.erb | 2 +- 4 files changed, 44 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/whats_new/utils/notification.js b/app/assets/javascripts/whats_new/utils/notification.js index 3d4326c4b3a..66ee3b1a971 100644 --- a/app/assets/javascripts/whats_new/utils/notification.js +++ b/app/assets/javascripts/whats_new/utils/notification.js @@ -7,12 +7,7 @@ export const setNotification = (appEl) => { const notificationEl = document.querySelector('.header-help'); let notificationCountEl = notificationEl.querySelector('.js-whats-new-notification-count'); - const legacyStorageKey = 'display-whats-new-notification-13.10'; - const localStoragePairs = [ - [legacyStorageKey, false], - [STORAGE_KEY, versionDigest], - ]; - if (localStoragePairs.some((pair) => localStorage.getItem(pair[0]) === pair[1].toString())) { + if (localStorage.getItem(STORAGE_KEY) === versionDigest) { notificationEl.classList.remove('with-notifications'); if (notificationCountEl) { notificationCountEl.parentElement.removeChild(notificationCountEl); diff --git a/app/helpers/in_product_marketing_helper.rb b/app/helpers/in_product_marketing_helper.rb index 2574b57a82e..9e59a04d709 100644 --- a/app/helpers/in_product_marketing_helper.rb +++ b/app/helpers/in_product_marketing_helper.rb @@ -193,8 +193,12 @@ module InProductMarketingHelper end end - def in_product_marketing_progress(track, series) - s_('InProductMarketing|This is email %{series} of 3 in the %{track} series.') % { series: series + 1, track: track.to_s.humanize } + def in_product_marketing_progress(track, series, format: nil) + if Gitlab.com? + s_('InProductMarketing|This is email %{series} of 3 in the %{track} series.') % { series: series + 1, track: track.to_s.humanize } + else + s_('InProductMarketing|This is email %{series} of 3 in the %{track} series. To disable notification emails sent by your local GitLab instance, either contact your administrator or %{unsubscribe_link}.') % { series: series + 1, track: track.to_s.humanize, unsubscribe_link: unsubscribe_link(format) } + end end def footer_links(format: nil) @@ -220,11 +224,9 @@ module InProductMarketingHelper s_('InProductMarketing|%{strong_start}GitLab Inc.%{strong_end} 268 Bush Street, #350, San Francisco, CA 94104, USA').html_safe % strong_options(format) end - def unsubscribe(format: nil) - parts = [ - s_('InProductMarketing|If you no longer wish to receive marketing emails from us,'), - s_('InProductMarketing|you may %{unsubscribe_link} at any time.') % { unsubscribe_link: unsubscribe_link(format) } - ] + def unsubscribe(track, series, format: nil) + parts = Gitlab.com? ? unsubscribe_com(format) : unsubscribe_self_managed(track, series, format) + case format when :html parts.join(' ') @@ -235,6 +237,20 @@ module InProductMarketingHelper private + def unsubscribe_com(format) + [ + s_('InProductMarketing|If you no longer wish to receive marketing emails from us,'), + s_('InProductMarketing|you may %{unsubscribe_link} at any time.') % { unsubscribe_link: unsubscribe_link(format) } + ] + end + + def unsubscribe_self_managed(track, series, format) + [ + s_('InProductMarketing|To opt out of these onboarding emails, %{unsubscribe_link}.') % { unsubscribe_link: unsubscribe_link(format) }, + s_("InProductMarketing|If you don't want to receive marketing emails directly from GitLab, %{marketing_preference_link}.") % { marketing_preference_link: marketing_preference_link(track, series, format) } + ] + end + def in_product_marketing_cta_text(track, series) { create: [ @@ -314,9 +330,23 @@ module InProductMarketingHelper def unsubscribe_link(format) unsubscribe_url = Gitlab.com? ? '%tag_unsubscribe_url%' : profile_notifications_url + link(s_('InProductMarketing|unsubscribe'), unsubscribe_url, format) end + def marketing_preference_link(track, series, format) + params = { + utm_source: 'SM', + utm_medium: 'email', + utm_campaign: 'onboarding', + utm_term: "#{track}_#{series}" + } + + preference_link = "https://about.gitlab.com/company/preference-center/?#{params.to_query}" + + link(s_('InProductMarketing|update your preferences'), preference_link, format) + end + def link(text, link, format) case format when :html diff --git a/app/views/notify/in_product_marketing_email.html.haml b/app/views/notify/in_product_marketing_email.html.haml index 39f084efe40..015a12bbb6d 100644 --- a/app/views/notify/in_product_marketing_email.html.haml +++ b/app/views/notify/in_product_marketing_email.html.haml @@ -166,6 +166,10 @@ = 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 + = in_product_marketing_progress(@track, @series, format: :html).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%" } = in_product_marketing_logo(@track, @series) @@ -183,10 +187,6 @@ %tr %td{ align: "center", style: "padding: 10px 20px 80px 20px; font-family: 'Source Sans Pro', helvetica, arial, sans-serif;" } .cta_link= cta_link(@track, @series, @group, format: :html) - %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 - = in_product_marketing_progress(@track, @series) %tr{ style: "background-color: #ffffff;" } %td{ align: "center", style: "padding:75px 20px 25px;" } = about_link('', 'gitlab_logo.png', 80) @@ -202,4 +202,4 @@ %tr{ style: "background-color: #ffffff;" } %td{ align: "left", style: "padding:20px 30px 20px 30px;" } %span.footernav{ style: "color: #6e49cb; font-size: 14px; line-height: 20px; font-family: 'Source Sans Pro', helvetica, arial, sans-serif; color:#424242;" } - = unsubscribe(format: :html).html_safe + = unsubscribe(@track, @series, format: :html).html_safe diff --git a/app/views/notify/in_product_marketing_email.text.erb b/app/views/notify/in_product_marketing_email.text.erb index ecc4c565b73..bc8315e49a0 100644 --- a/app/views/notify/in_product_marketing_email.text.erb +++ b/app/views/notify/in_product_marketing_email.text.erb @@ -20,4 +20,4 @@ <%= address %> -<%= unsubscribe %> +<%= unsubscribe(@track, @series) %> -- cgit v1.2.1