Reopen mr email notification.
This commit is contained in:
parent
1208c6caa8
commit
310231dbed
5 changed files with 28 additions and 0 deletions
|
@ -41,6 +41,19 @@ module Emails
|
|||
to: recipient(recipient_id),
|
||||
subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
|
||||
end
|
||||
|
||||
def merge_request_status_email(recipient_id, merge_request_id, status, updated_by_user_id)
|
||||
@merge_request = MergeRequest.find(merge_request_id)
|
||||
@mr_status = status
|
||||
@project = @merge_request.project
|
||||
@updated_by = User.find updated_by_user_id
|
||||
@target_url = project_merge_request_url(@project, @merge_request)
|
||||
set_reference("merge_request_#{merge_request_id}")
|
||||
|
||||
mail(from: sender(updated_by_user_id),
|
||||
to: recipient(recipient_id),
|
||||
subject: subject("#{@merge_request.title} (##{@merge_request.iid}) #{@mr_status}"))
|
||||
end
|
||||
end
|
||||
|
||||
# Over rides default behavour to show source/target
|
||||
|
|
|
@ -3,6 +3,7 @@ module MergeRequests
|
|||
def execute(merge_request)
|
||||
if merge_request.reopen
|
||||
event_service.reopen_mr(merge_request, current_user)
|
||||
notification_service.reopen_mr(merge_request, current_user)
|
||||
create_note(merge_request)
|
||||
execute_hooks(merge_request)
|
||||
merge_request.reload_code
|
||||
|
|
|
@ -99,6 +99,10 @@ class NotificationService
|
|||
end
|
||||
end
|
||||
|
||||
def reopen_mr(merge_request, current_user)
|
||||
reopen_resource_email(merge_request, merge_request.target_project, current_user, 'merge_request_status_email', 'reopened')
|
||||
end
|
||||
|
||||
# Notify new user with email after creation
|
||||
def new_user(user)
|
||||
# Don't email omniauth created users
|
||||
|
|
2
app/views/notify/merge_request_status_email.html.haml
Normal file
2
app/views/notify/merge_request_status_email.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
%p
|
||||
= "Merge Request ##{@merge_request.iid} was #{@mr_status} by #{@updated_by.name}"
|
8
app/views/notify/merge_request_status_email.text.haml
Normal file
8
app/views/notify/merge_request_status_email.text.haml
Normal file
|
@ -0,0 +1,8 @@
|
|||
= "Merge Request ##{@merge_request.iid} was #{@mr_status} by #{@updated_by.name}"
|
||||
|
||||
Merge Request url: #{project_merge_request_url(@merge_request.target_project, @merge_request)}
|
||||
|
||||
= merge_path_description(@merge_request, 'to')
|
||||
|
||||
Author: #{@merge_request.author_name}
|
||||
Assignee: #{@merge_request.assignee_name}
|
Loading…
Reference in a new issue