fix: CC conditions when the last email is from someone else (#7010)
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user