Skip to content
代码片段 群组 项目
提交 25297399 编辑于 作者: eugielimpin's avatar eugielimpin
浏览文件

Move account validation email under EE

Account validation email will only be sent in EE.
上级 b8597825
No related branches found
No related tags found
无相关合并请求
...@@ -21,12 +21,6 @@ def in_product_marketing_email(recipient_id, group_id, track, series) ...@@ -21,12 +21,6 @@ def in_product_marketing_email(recipient_id, group_id, track, series)
mail_to(to: email, subject: @message.subject_line) mail_to(to: email, subject: @message.subject_line)
end end
def account_validation_email(pipeline, recipient_email)
@message = Gitlab::Email::Message::AccountValidation.new(pipeline)
mail_to(to: recipient_email, subject: @message.subject_line)
end
private private
def mail_to(to:, subject:) def mail_to(to:, subject:)
...@@ -47,3 +41,5 @@ def mail_to(to:, subject:) ...@@ -47,3 +41,5 @@ def mail_to(to:, subject:)
end end
end end
end end
Emails::InProductMarketing.prepend_mod
# frozen_string_literal: true
module EE
module Emails
module InProductMarketing
def account_validation_email(pipeline, recipient_email)
@message = ::Gitlab::Email::Message::AccountValidation.new(pipeline)
mail_to(to: recipient_email, subject: @message.subject_line)
end
end
end
end
...@@ -14,6 +14,7 @@ module Notify ...@@ -14,6 +14,7 @@ module Notify
include ::Emails::UserCap include ::Emails::UserCap
include ::Emails::OncallRotation include ::Emails::OncallRotation
include ::Emails::GroupMemberships include ::Emails::GroupMemberships
include ::Emails::InProductMarketing
end end
attr_reader :group attr_reader :group
......
# frozen_string_literal: true
require 'spec_helper'
require 'email_spec'
RSpec.describe Emails::InProductMarketing do
include EmailSpec::Matchers
include Gitlab::Routing.url_helpers
let_it_be(:user) { create(:user) }
describe '#account_validation_email' do
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project) { create(:project, :repository, namespace: namespace) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
subject { Notify.account_validation_email(pipeline, user.notification_email_or_default) }
it 'sends to the right user with a link to unsubscribe' do
expect(subject).to deliver_to(user.notification_email_or_default)
end
it 'has the correct subject and content' do
message = Gitlab::Email::Message::AccountValidation.new(pipeline)
cta_url = project_pipeline_url(pipeline.project, pipeline)
cta2_url = 'https://docs.gitlab.com/runner/install/'
aggregate_failures do
is_expected.to have_subject(message.subject_line)
is_expected.to have_body_text(message.title)
is_expected.to have_body_text(message.body_line1)
is_expected.to have_body_text(CGI.unescapeHTML(message.body_line2))
is_expected.to have_body_text(CGI.unescapeHTML(message.cta_link))
is_expected.to have_body_text(CGI.unescapeHTML(message.cta2_link))
is_expected.to have_body_text(cta_url)
is_expected.to have_body_text(cta2_url)
end
end
end
end
...@@ -108,35 +108,4 @@ ...@@ -108,35 +108,4 @@
end end
end end
end end
describe '#account_validation_email' do
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project) { create(:project, :repository, namespace: namespace) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
subject { Notify.account_validation_email(pipeline, user.notification_email_or_default) }
it 'sends to the right user with a link to unsubscribe' do
expect(subject).to deliver_to(user.notification_email_or_default)
end
it_behaves_like 'has custom headers when on gitlab.com'
it 'has the correct subject and content' do
message = Gitlab::Email::Message::AccountValidation.new(pipeline)
cta_url = project_pipeline_url(pipeline.project, pipeline)
cta2_url = 'https://docs.gitlab.com/runner/install/'
aggregate_failures do
is_expected.to have_subject(message.subject_line)
is_expected.to have_body_text(message.title)
is_expected.to have_body_text(message.body_line1)
is_expected.to have_body_text(CGI.unescapeHTML(message.body_line2))
is_expected.to have_body_text(CGI.unescapeHTML(message.cta_link))
is_expected.to have_body_text(CGI.unescapeHTML(message.cta2_link))
is_expected.to have_body_text(cta_url)
is_expected.to have_body_text(cta2_url)
end
end
end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册