fix: CC conditions when the last email is from someone else (#7010)

This commit is contained in:
Shivam Mishra
2023-06-29 08:58:44 +05:30
committed by GitHub
parent 40830046e8
commit 28e7a5d228
7 changed files with 116 additions and 18 deletions

View File

@@ -162,6 +162,20 @@ class ConversationReplyMailer < ApplicationMailer
[content_attributes[:cc_emails], content_attributes[:bcc_emails]]
end
def to_emails_from_content_attributes
content_attributes = @conversation.messages.outgoing.last&.content_attributes
return [] unless content_attributes
return [] unless content_attributes[:to_emails]
content_attributes[:to_emails]
end
def to_emails
# if there is no to_emails from content_attributes, send it to @contact&.email
to_emails_from_content_attributes.presence || [@contact&.email]
end
def inbound_email_enabled?
@inbound_email_enabled ||= @account.feature_enabled?('inbound_emails') && @account.inbound_email_domain
.present? && @account.support_email.present?

View File

@@ -1,7 +1,7 @@
module ConversationReplyMailerHelper
def prepare_mail(cc_bcc_enabled)
@options = {
to: @contact&.email,
to: to_emails,
from: email_from,
reply_to: email_reply_to,
subject: mail_subject,