feat: add references header to reply emails (#11719)

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Shivam Mishra
2025-07-29 14:24:14 +04:00
committed by GitHub
parent 441cc065ae
commit 6475a6a593
10 changed files with 449 additions and 17 deletions

View File

@@ -46,6 +46,7 @@ RSpec.describe MailPresenter do
:message_id,
:multipart,
:number_of_attachments,
:references,
:subject,
:text_content,
:to
@@ -100,6 +101,31 @@ RSpec.describe MailPresenter do
end
end
describe '#references' do
let(:references_mail) { create_inbound_email_from_fixture('references.eml').mail }
let(:mail_presenter_with_references) { described_class.new(references_mail) }
context 'when mail has references' do
it 'returns an array of reference IDs' do
expect(mail_presenter_with_references.references).to eq(['4e6e35f5a38b4_479f13bb90078178@small-app-01.mail', 'test-reference-id'])
end
end
context 'when mail has no references' do
it 'returns an empty array' do
mail_presenter = described_class.new(mail_without_in_reply_to)
expect(mail_presenter.references).to eq([])
end
end
context 'when references are included in serialized_data' do
it 'includes references in the serialized data' do
data = mail_presenter_with_references.serialized_data
expect(data[:references]).to eq(['4e6e35f5a38b4_479f13bb90078178@small-app-01.mail', 'test-reference-id'])
end
end
end
describe 'auto_reply?' do
let(:auto_reply_mail) { create_inbound_email_from_fixture('auto_reply.eml').mail }
let(:auto_reply_with_auto_submitted_mail) { create_inbound_email_from_fixture('auto_reply_with_auto_submitted.eml').mail }