Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
25297399
Commit
25297399
authored
Dec 07, 2021
by
eugielimpin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move account validation email under EE
Account validation email will only be sent in EE.
parent
b8597825
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
37 deletions
+56
-37
app/mailers/emails/in_product_marketing.rb
app/mailers/emails/in_product_marketing.rb
+2
-6
ee/app/mailers/ee/emails/in_product_marketing.rb
ee/app/mailers/ee/emails/in_product_marketing.rb
+13
-0
ee/app/mailers/ee/notify.rb
ee/app/mailers/ee/notify.rb
+1
-0
ee/lib/gitlab/email/message/account_validation.rb
ee/lib/gitlab/email/message/account_validation.rb
+0
-0
ee/spec/lib/gitlab/email/message/account_validation_spec.rb
ee/spec/lib/gitlab/email/message/account_validation_spec.rb
+0
-0
ee/spec/mailers/emails/in_product_marketing_spec.rb
ee/spec/mailers/emails/in_product_marketing_spec.rb
+40
-0
spec/mailers/emails/in_product_marketing_spec.rb
spec/mailers/emails/in_product_marketing_spec.rb
+0
-31
No files found.
app/mailers/emails/in_product_marketing.rb
View file @
25297399
...
...
@@ -21,12 +21,6 @@ module Emails
mail_to
(
to:
email
,
subject:
@message
.
subject_line
)
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
def
mail_to
(
to
:,
subject
:)
...
...
@@ -47,3 +41,5 @@ module Emails
end
end
end
Emails
::
InProductMarketing
.
prepend_mod
ee/app/mailers/ee/emails/in_product_marketing.rb
0 → 100644
View file @
25297399
# 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
ee/app/mailers/ee/notify.rb
View file @
25297399
...
...
@@ -14,6 +14,7 @@ module EE
include
::
Emails
::
UserCap
include
::
Emails
::
OncallRotation
include
::
Emails
::
GroupMemberships
include
::
Emails
::
InProductMarketing
end
attr_reader
:group
...
...
lib/gitlab/email/message/account_validation.rb
→
ee/
lib/gitlab/email/message/account_validation.rb
View file @
25297399
File moved
spec/lib/gitlab/email/message/account_validation_spec.rb
→
ee/
spec/lib/gitlab/email/message/account_validation_spec.rb
View file @
25297399
File moved
ee/spec/mailers/emails/in_product_marketing_spec.rb
0 → 100644
View file @
25297399
# 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
spec/mailers/emails/in_product_marketing_spec.rb
View file @
25297399
...
...
@@ -108,35 +108,4 @@ RSpec.describe Emails::InProductMarketing do
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment