chore: Enable email channel (#1851)

This commit is contained in:
Sojan Jose
2021-03-04 13:59:59 +05:30
committed by GitHub
parent 6aed01de0c
commit ca4a766b82
15 changed files with 54 additions and 48 deletions

View File

@@ -22,7 +22,7 @@ class ApplicationMailbox < ActionMailbox::Base
proc do |inbound_mail_obj|
is_a_support_email = false
inbound_mail_obj.mail.to.each do |email|
channel = Channel::Email.find_by(email: email)
channel = Channel::Email.find_by('email = ? OR forward_to_email = ?', email, email)
if channel.present?
is_a_support_email = true
break
@@ -37,7 +37,10 @@ class ApplicationMailbox < ActionMailbox::Base
end
# routing should be defined below the referenced procs
# routes as a reply to existing conversations
routing(reply_mail? => :reply)
# routes as a new conversation in email channel
routing(support_mail? => :support)
routing(catch_all_mail? => :default)
end