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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
ac6b634d
Commit
ac6b634d
authored
Jul 28, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send notification email when all discussions are resolved
parent
fa4a6135
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
1 deletion
+22
-1
app/mailers/emails/merge_requests.rb
app/mailers/emails/merge_requests.rb
+7
-0
app/services/merge_requests/all_discussions_resolved_service.rb
...rvices/merge_requests/all_discussions_resolved_service.rb
+1
-0
app/services/notification_service.rb
app/services/notification_service.rb
+9
-1
app/views/notify/resolved_all_discussions_email.html.haml
app/views/notify/resolved_all_discussions_email.html.haml
+2
-0
app/views/notify/resolved_all_discussions_email.text.erb
app/views/notify/resolved_all_discussions_email.text.erb
+3
-0
No files found.
app/mailers/emails/merge_requests.rb
View file @
ac6b634d
...
...
@@ -42,6 +42,13 @@ module Emails
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
updated_by_user_id
,
recipient_id
))
end
def
resolved_all_discussions_email
(
recipient_id
,
merge_request_id
,
resolved_by_user_id
)
setup_merge_request_mail
(
merge_request_id
,
recipient_id
)
@resolved_by
=
User
.
find
(
resolved_by_user_id
)
mail_answer_thread
(
@merge_request
,
merge_request_thread_options
(
resolved_by_user_id
,
recipient_id
))
end
private
def
setup_merge_request_mail
(
merge_request_id
,
recipient_id
)
...
...
app/services/merge_requests/all_discussions_resolved_service.rb
View file @
ac6b634d
...
...
@@ -4,6 +4,7 @@ module MergeRequests
return
unless
merge_request
.
discussions_resolved?
SystemNoteService
.
resolve_all_discussions
(
merge_request
,
project
,
current_user
)
notification_service
.
resolve_all_discussions
(
merge_request
,
current_user
)
end
end
end
app/services/notification_service.rb
View file @
ac6b634d
...
...
@@ -120,6 +120,14 @@ class NotificationService
)
end
def
resolve_all_discussions
(
merge_request
,
current_user
)
recipients
=
build_recipients
(
merge_request
,
merge_request
.
target_project
,
current_user
,
action:
"resolve_all_discussions"
)
recipients
.
each
do
|
recipient
|
mailer
.
resolved_all_discussions_email
(
recipient
.
id
,
merge_request
.
id
,
current_user
.
id
).
deliver_later
end
end
# Notify new user with email after creation
def
new_user
(
user
,
token
=
nil
)
# Don't email omniauth created users
...
...
@@ -177,7 +185,7 @@ class NotificationService
# build notify method like 'note_commit_email'
notify_method
=
"note_
#{
note
.
noteable_type
.
underscore
}
_email"
.
to_sym
recipients
.
each
do
|
recipient
|
mailer
.
send
(
notify_method
,
recipient
.
id
,
note
.
id
).
deliver_later
end
...
...
app/views/notify/resolved_all_discussions_email.html.haml
0 → 100644
View file @
ac6b634d
%p
All discussions on Merge Request
#{
@merge_request
.
to_reference
}
were resolved by
#{
@resolved_by
.
name
}
app/views/notify/resolved_all_discussions_email.text.erb
0 → 100644
View file @
ac6b634d
All discussions on Merge Request
<%=
@merge_request
.
to_reference
%>
were resolved by
<%=
@resolved_by
.
name
%>
<%=
url_for
(
namespace_project_merge_request_url
(
@merge_request
.
target_project
.
namespace
,
@merge_request
.
target_project
,
@merge_request
))
%>
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