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
4c2cd506
Commit
4c2cd506
authored
Oct 23, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE-specific lines from MR mailer
parent
506a5f8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
21 deletions
+78
-21
app/mailers/emails/merge_requests.rb
app/mailers/emails/merge_requests.rb
+2
-21
ee/app/mailers/emails/ee/merge_requests.rb
ee/app/mailers/emails/ee/merge_requests.rb
+28
-0
ee/spec/mailers/emails/ee/merge_requests_spec.rb
ee/spec/mailers/emails/ee/merge_requests_spec.rb
+48
-0
No files found.
app/mailers/emails/merge_requests.rb
View file @
4c2cd506
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
Emails
module
Emails
module
MergeRequests
module
MergeRequests
prepend
Emails
::
EE
::
MergeRequests
def
new_merge_request_email
(
recipient_id
,
merge_request_id
,
reason
=
nil
)
def
new_merge_request_email
(
recipient_id
,
merge_request_id
,
reason
=
nil
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
,
present:
true
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
,
present:
true
)
...
@@ -67,27 +69,6 @@ module Emails
...
@@ -67,27 +69,6 @@ module Emails
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
@merge_request
.
author_id
,
recipient_id
,
reason
))
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
@merge_request
.
author_id
,
recipient_id
,
reason
))
end
end
def
add_merge_request_approver_email
(
recipient_id
,
merge_request_id
,
updated_by_user_id
,
reason
=
nil
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
,
present:
true
)
@updated_by
=
User
.
find
(
updated_by_user_id
)
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
updated_by_user_id
,
recipient_id
,
reason
))
end
def
approved_merge_request_email
(
recipient_id
,
merge_request_id
,
approved_by_user_id
,
reason
=
nil
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
)
@approved_by
=
User
.
find
(
approved_by_user_id
)
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
approved_by_user_id
,
recipient_id
,
reason
))
end
def
unapproved_merge_request_email
(
recipient_id
,
merge_request_id
,
unapproved_by_user_id
,
reason
=
nil
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
)
@unapproved_by
=
User
.
find
(
unapproved_by_user_id
)
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
unapproved_by_user_id
,
recipient_id
,
reason
))
end
def
resolved_all_discussions_email
(
recipient_id
,
merge_request_id
,
resolved_by_user_id
,
reason
=
nil
)
def
resolved_all_discussions_email
(
recipient_id
,
merge_request_id
,
resolved_by_user_id
,
reason
=
nil
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
)
...
...
ee/app/mailers/emails/ee/merge_requests.rb
0 → 100644
View file @
4c2cd506
# frozen_string_literal: true
module
Emails
module
EE
module
MergeRequests
def
add_merge_request_approver_email
(
recipient_id
,
merge_request_id
,
updated_by_user_id
,
reason
=
nil
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
,
present:
true
)
@updated_by
=
User
.
find
(
updated_by_user_id
)
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
updated_by_user_id
,
recipient_id
,
reason
))
end
def
approved_merge_request_email
(
recipient_id
,
merge_request_id
,
approved_by_user_id
,
reason
=
nil
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
)
@approved_by
=
User
.
find
(
approved_by_user_id
)
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
approved_by_user_id
,
recipient_id
,
reason
))
end
def
unapproved_merge_request_email
(
recipient_id
,
merge_request_id
,
unapproved_by_user_id
,
reason
=
nil
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
)
@unapproved_by
=
User
.
find
(
unapproved_by_user_id
)
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
unapproved_by_user_id
,
recipient_id
,
reason
))
end
end
end
end
ee/spec/mailers/emails/ee/merge_requests_spec.rb
0 → 100644
View file @
4c2cd506
# frozen_string_literal: true
require
'spec_helper'
require
'email_spec'
describe
Emails
::
EE
::
MergeRequests
do
include
EmailSpec
::
Matchers
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:current_user
)
{
create
(
:user
)
}
describe
'#add_merge_request_approver_email'
do
subject
{
Notify
.
add_merge_request_approver_email
(
user
.
id
,
merge_request
.
id
,
current_user
.
id
)
}
context
'when email_author_in_body is set'
do
it
'includes the name of the person who added the approver'
do
stub_application_setting
(
email_author_in_body:
true
)
expect
(
subject
).
to
have_body_text
(
current_user
.
name
)
end
end
context
'when email_author_in_body is not set'
do
it
'does not include the name of the person who added the approver'
do
stub_application_setting
(
email_author_in_body:
false
)
expect
(
subject
).
not_to
have_body_text
(
current_user
.
name
)
end
end
end
describe
'#approved_merge_request_email'
do
subject
{
Notify
.
approved_merge_request_email
(
user
.
id
,
merge_request
.
id
,
current_user
.
id
)
}
it
'includes the name of the approver'
do
expect
(
subject
).
to
have_body_text
(
current_user
.
name
)
end
end
describe
'#unapproved_merge_request_email'
do
subject
{
Notify
.
unapproved_merge_request_email
(
user
.
id
,
merge_request
.
id
,
current_user
.
id
)
}
it
'includes the name of the person who removed their approval'
do
expect
(
subject
).
to
have_body_text
(
current_user
.
name
)
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