From c267acfcf715084f5cef69dbaada2f5cb8a86fbf Mon Sep 17 00:00:00 2001 From: ThibG Date: Sun, 24 Sep 2017 11:19:42 +0200 Subject: [PATCH] Thread toot notification mails by conversation (#5061) * Thread toot notification mails by conversation * Make codeclimate happy and avoid potential mis-threading --- app/mailers/notification_mailer.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 12b92bf45..80c9d8ccf 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -8,6 +8,7 @@ class NotificationMailer < ApplicationMailer @status = notification.target_status locale_for_account(@me) do + thread_by_conversation(@status.conversation) mail to: @me.user.email, subject: I18n.t('notification_mailer.mention.subject', name: @status.account.acct) end end @@ -27,6 +28,7 @@ class NotificationMailer < ApplicationMailer @status = notification.target_status locale_for_account(@me) do + thread_by_conversation(@status.conversation) mail to: @me.user.email, subject: I18n.t('notification_mailer.favourite.subject', name: @account.acct) end end @@ -37,6 +39,7 @@ class NotificationMailer < ApplicationMailer @status = notification.target_status locale_for_account(@me) do + thread_by_conversation(@status.conversation) mail to: @me.user.email, subject: I18n.t('notification_mailer.reblog.subject', name: @account.acct) end end @@ -67,4 +70,13 @@ class NotificationMailer < ApplicationMailer ) end end + + private + + def thread_by_conversation(conversation) + return if conversation.nil? + msg_id = "" + headers['In-Reply-To'] = msg_id + headers['References'] = msg_id + end end