From 23a20c20f826f090446587881df7008a137d2d34 Mon Sep 17 00:00:00 2001 From: Mario de la Ossa Date: Thu, 28 Dec 2017 11:25:02 -0600 Subject: Initial work to add notification reason to emails Adds `#build_notification_recipients` to `NotificationRecipientService` that returns the `NotificationRecipient` objects in order to be able to access the new attribute `reason`. This new attribute is used in the different notifier methods in order to add the reason as a header: `X-GitLab-NotificationReason`. Only the reason with the most priority gets sent. --- app/mailers/notify.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/mailers/notify.rb') diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index ec886e993c3..eade0fe278f 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -112,6 +112,8 @@ class Notify < BaseMailer headers["X-GitLab-#{model.class.name}-ID"] = model.id headers['X-GitLab-Reply-Key'] = reply_key + @reason = headers['X-GitLab-NotificationReason'] + if Gitlab::IncomingEmail.enabled? && @sent_notification address = Mail::Address.new(Gitlab::IncomingEmail.reply_address(reply_key)) address.display_name = @project.name_with_namespace -- cgit v1.2.1