Enhancement: Threaded email replies for a conversation (#885) (#886)

* Added custom Message-ID and In-Reply-To headers for conversation reply emails
* Added new global config for the default domain (This is used in the above headers)
* Added migration to run the config loader to load the new global config value
* The subject of the conversation reply mailer was made static (This is required for threaded emails)
* Added required tests
This commit is contained in:
Sony Mathew
2020-05-22 18:14:18 +05:30
committed by GitHub
parent 11b4b4ea3f
commit 6230f4d796
6 changed files with 58 additions and 9 deletions

View File

@@ -19,7 +19,7 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
let(:mail) { described_class.reply_with_summary(message.conversation, Time.zone.now).deliver_now }
it 'renders the subject' do
expect(mail.subject).to eq("[##{message.conversation.display_id}] #{message.content.truncate(30)}")
expect(mail.subject).to eq("[##{message.conversation.display_id}] New messages on this conversation")
end
it 'not have private notes' do
@@ -44,6 +44,14 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
it 'renders the reply to email' do
expect(mail.reply_to).to eq([message&.conversation&.assignee&.email])
end
it 'sets the correct custom message id' do
expect(mail.message_id).to eq("<conversation/#{conversation.uuid}/messages/#{message.id}@>")
end
it 'sets the correct in reply to id' do
expect(mail.in_reply_to).to eq("<account/#{conversation.account.id}/conversation/#{conversation.uuid}@>")
end
end
context 'when the cutsom domain emails are enabled' do
@@ -67,6 +75,14 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
it 'sets the from email to be the support email' do
expect(mail.from).to eq([conversation.account.support_email])
end
it 'sets the correct custom message id' do
expect(mail.message_id).to eq("conversation/#{conversation.uuid}/messages/#{message.id}@#{conversation.account.domain}")
end
it 'sets the correct in reply to id' do
expect(mail.in_reply_to).to eq("account/#{conversation.account.id}/conversation/#{conversation.uuid}@#{conversation.account.domain}")
end
end
end
end