Chore: Change the prefix in reply emails (#1060)

* Chore: Change the prefix in reply emails

In conversation continuity the reply to email was looking like

reply+to+{some_random_hex_id}@reply.chatwoot.com

Changed the prefix to just `reply` instead of `reply+to`.

* Chore: Change reply email prefix in outbound emails

Changed the prefix from `reply+to+` to just `reply+` in
the reply emails in the converstaion related outbound emails.
This commit is contained in:
Sony Mathew 2020-07-19 13:34:34 +05:30 committed by GitHub
parent 642efe8d40
commit 7ef45e5844
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,7 @@
class ApplicationMailbox < ActionMailbox::Base class ApplicationMailbox < ActionMailbox::Base
# Last part is the regex for the UUID # Last part is the regex for the UUID
# Eg: email should be something like : reply+to+6bdc3f4d-0bec-4515-a284-5d916fdde489@domain.com # Eg: email should be something like : reply+6bdc3f4d-0bec-4515-a284-5d916fdde489@domain.com
REPLY_EMAIL_USERNAME_PATTERN = /^reply\+to\+([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})$/i.freeze REPLY_EMAIL_USERNAME_PATTERN = /^reply\+([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})$/i.freeze
def self.reply_match_proc def self.reply_match_proc
proc do |inbound_mail_obj| proc do |inbound_mail_obj|

View file

@ -2,8 +2,8 @@ class ConversationMailbox < ApplicationMailbox
attr_accessor :conversation_uuid, :processed_mail attr_accessor :conversation_uuid, :processed_mail
# Last part is the regex for the UUID # Last part is the regex for the UUID
# Eg: email should be something like : reply+to+6bdc3f4d-0bec-4515-a284-5d916fdde489@domain.com # Eg: email should be something like : reply+6bdc3f4d-0bec-4515-a284-5d916fdde489@domain.com
EMAIL_PART_PATTERN = /^reply\+to\+([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})$/i.freeze EMAIL_PART_PATTERN = /^reply\+([0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12})$/i.freeze
before_processing :conversation_uuid_from_to_address, before_processing :conversation_uuid_from_to_address,
:verify_decoded_params, :verify_decoded_params,

View file

@ -55,7 +55,7 @@ class ConversationReplyMailer < ApplicationMailer
def reply_email def reply_email
if custom_domain_email_enabled? if custom_domain_email_enabled?
"reply+to+#{@conversation.uuid}@#{@account.domain}" "reply+#{@conversation.uuid}@#{@account.domain}"
else else
@agent&.email @agent&.email
end end

View file

@ -4,7 +4,7 @@ Content-Type: multipart/alternative; boundary="Apple-Mail=_33A037C7-4BB3-4772-AE
Subject: Discussion: Let's debate these attachments Subject: Discussion: Let's debate these attachments
Date: Tue, 20 Apr 2020 04:20:20 -0400 Date: Tue, 20 Apr 2020 04:20:20 -0400
In-Reply-To: <4e6e35f5a38b4_479f13bb90078178@small-app-01.mail> In-Reply-To: <4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>
To: "Replies" <reply+to+6bdc3f4d-0bec-4515-a284-5d916fdde489@example.com> To: "Replies" <reply+6bdc3f4d-0bec-4515-a284-5d916fdde489@example.com>
References: <4e6e35f5a38b4_479f13bb90078178@small-app-01.mail> References: <4e6e35f5a38b4_479f13bb90078178@small-app-01.mail>
Message-Id: <0CB459E0-0336-41DA-BC88-E6E28C697DDB@chatwoot.com> Message-Id: <0CB459E0-0336-41DA-BC88-E6E28C697DDB@chatwoot.com>
X-Mailer: Apple Mail (2.1244.3) X-Mailer: Apple Mail (2.1244.3)

View file

@ -100,7 +100,7 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
end end
it 'sets reply to email to be based on the domain' do it 'sets reply to email to be based on the domain' do
reply_to_email = "reply+to+#{message.conversation.uuid}@#{conversation.account.domain}" reply_to_email = "reply+#{message.conversation.uuid}@#{conversation.account.domain}"
expect(mail.reply_to).to eq([reply_to_email]) expect(mail.reply_to).to eq([reply_to_email])
end end