diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities/project.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/email/message/in_product_marketing/base.rb | 30 | ||||
-rw-r--r-- | lib/gitlab/email/message/in_product_marketing/helper.rb | 31 |
3 files changed, 37 insertions, 28 deletions
diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb index 60cc5167c41..7cff5fd428e 100644 --- a/lib/api/entities/project.rb +++ b/lib/api/entities/project.rb @@ -35,6 +35,10 @@ module API expose :members do |project| expose_url(api_v4_projects_members_path(id: project.id)) end + + expose :cluster_agents do |project| + expose_url(api_v4_projects_cluster_agents_path(id: project.id)) + end end expose :packages_enabled diff --git a/lib/gitlab/email/message/in_product_marketing/base.rb b/lib/gitlab/email/message/in_product_marketing/base.rb index 9b50d86de58..bd20b7e5fc7 100644 --- a/lib/gitlab/email/message/in_product_marketing/base.rb +++ b/lib/gitlab/email/message/in_product_marketing/base.rb @@ -70,14 +70,8 @@ module Gitlab end def unsubscribe - parts = Gitlab.com? ? unsubscribe_com : unsubscribe_self_managed(track, series) - - case format - when :html - parts.join(' ') - else - parts.join("\n" + ' ' * 16) - end + self_managed_preferences_link = marketing_preference_link(track, series) + unsubscribe_message(self_managed_preferences_link) end def progress(current: series + 1, total: total_series, track_name: track.to_s.humanize) @@ -110,26 +104,6 @@ module Gitlab Namespaces::InProductMarketingEmailsService::TRACKS[track][:interval_days].size end - def unsubscribe_com - [ - 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 } - ] - end - - def unsubscribe_self_managed(track, series) - [ - s_('InProductMarketing|To opt out of these onboarding emails, %{unsubscribe_link}.') % { unsubscribe_link: unsubscribe_link }, - 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) } - ] - end - - def unsubscribe_link - unsubscribe_url = Gitlab.com? ? '%tag_unsubscribe_url%' : profile_notifications_url - - link(s_('InProductMarketing|unsubscribe'), unsubscribe_url) - end - def marketing_preference_link(track, series) params = { utm_source: 'SM', diff --git a/lib/gitlab/email/message/in_product_marketing/helper.rb b/lib/gitlab/email/message/in_product_marketing/helper.rb index 329cace9e9d..0a0e55c2999 100644 --- a/lib/gitlab/email/message/in_product_marketing/helper.rb +++ b/lib/gitlab/email/message/in_product_marketing/helper.rb @@ -31,8 +31,39 @@ module Gitlab s_('InProductMarketing|%{strong_start}GitLab Inc.%{strong_end} 268 Bush Street, #350, San Francisco, CA 94104, USA').html_safe % strong_options end + def unsubscribe_message(self_managed_preferences_link = nil) + parts = Gitlab.com? ? unsubscribe_com : unsubscribe_self_managed(self_managed_preferences_link) + + case format + when :html + parts.join(' ') + else + parts.join("\n" + ' ' * 16) + end + end + private + def unsubscribe_link + unsubscribe_url = Gitlab.com? ? '%tag_unsubscribe_url%' : profile_notifications_url + + link(s_('InProductMarketing|unsubscribe'), unsubscribe_url) + end + + def unsubscribe_com + [ + 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 } + ] + end + + def unsubscribe_self_managed(preferences_link) + [ + s_('InProductMarketing|To opt out of these onboarding emails, %{unsubscribe_link}.') % { unsubscribe_link: unsubscribe_link }, + s_("InProductMarketing|If you don't want to receive marketing emails directly from GitLab, %{marketing_preference_link}.") % { marketing_preference_link: preferences_link } + ] + end + def list(array) case format when :html |