mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
The term "sorcerer’s apprentice mode" is defined as a bug in a protocol where, under some circumstances, the receipt of a message causes multiple messages to be sent, each of which, when received, triggers the same bug. - RFC3834 Reference: https://github.com/chatwoot/chatwoot/pull/9606 This PR: - Adds an auto_reply attribute to message. - Adds an auto_reply attribute to conversation. - Disable conversation_created / conversation_opened event if auto_reply is set. - Disable message_created event if auto_reply is set. --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
21 lines
564 B
Ruby
21 lines
564 B
Ruby
module IncomingEmailValidityHelper
|
|
private
|
|
|
|
def incoming_email_from_valid_email?
|
|
return false unless valid_external_email_for_active_account?
|
|
|
|
# Return if email doesn't have a valid sender
|
|
# This can happen in cases like bounce emails for invalid contact email address
|
|
return false unless Devise.email_regexp.match?(@processed_mail.original_sender)
|
|
|
|
true
|
|
end
|
|
|
|
def valid_external_email_for_active_account?
|
|
return false unless @account.active?
|
|
return false if @processed_mail.notification_email_from_chatwoot?
|
|
|
|
true
|
|
end
|
|
end
|