chore: Disable fetching new emails after mailbox error (#4176)

- Disabled email fetch job if credentials for the channel isn't working
- notify customers when the email channel isn't working

fixes: https://github.com/chatwoot/chatwoot/issues/4174
This commit is contained in:
Sojan Jose
2022-03-22 12:14:17 +05:30
committed by GitHub
parent 715400f7ab
commit 467f3b9191
8 changed files with 48 additions and 8 deletions

View File

@@ -34,6 +34,7 @@
class Channel::Email < ApplicationRecord
include Channelable
include Reauthorizable
self.table_name = 'channel_email'
EDITABLE_ATTRS = [:email, :imap_enabled, :imap_email, :imap_password, :imap_address, :imap_port, :imap_enable_ssl, :imap_inbox_synced_at,

View File

@@ -39,10 +39,11 @@ module Reauthorizable
if (is_a? Integrations::Hook) && slack?
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).slack_disconnect.deliver_later
elsif is_a? Channel::FacebookPage
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).facebook_disconnect(inbox).deliver_later
elsif is_a? Channel::Email
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).email_disconnect(inbox).deliver_later
end
return unless is_a? Channel::FacebookPage
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).facebook_disconnect(inbox).deliver_later
end
# call this after you successfully Reauthorized the object in UI