summaryrefslogtreecommitdiff
path: root/app/services/notification_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/notification_service.rb')
-rw-r--r--app/services/notification_service.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 73e60ac8420..a4e935a8cf5 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -294,6 +294,7 @@ class NotificationService
return true if note.system_note_with_references?
send_new_note_notifications(note)
+ send_service_desk_notification(note)
end
def send_new_note_notifications(note)
@@ -305,6 +306,21 @@ class NotificationService
end
end
+ def send_service_desk_notification(note)
+ return unless Gitlab::ServiceDesk.supported?
+ return unless note.noteable_type == 'Issue'
+
+ issue = note.noteable
+ support_bot = User.support_bot
+
+ return unless issue.service_desk_reply_to.present?
+ return unless issue.project.service_desk_enabled?
+ return if note.author == support_bot
+ return unless issue.subscribed?(support_bot, issue.project)
+
+ mailer.service_desk_new_note_email(issue.id, note.id).deliver_later
+ end
+
# Notify users when a new release is created
def send_new_release_notifications(release)
recipients = NotificationRecipients::BuildService.build_new_release_recipients(release)
@@ -566,6 +582,14 @@ class NotificationService
end
end
+ def merge_when_pipeline_succeeds(merge_request, current_user)
+ recipients = ::NotificationRecipients::BuildService.build_recipients(merge_request, current_user, action: 'merge_when_pipeline_succeeds')
+
+ recipients.each do |recipient|
+ mailer.merge_when_pipeline_succeeds_email(recipient.user.id, merge_request.id, current_user.id).deliver_later
+ end
+ end
+
protected
def new_resource_email(target, method)