chore: Add reauthorization prompt for Whatsapp Channel (#5929)

- Add reauthorization prompt for Whatsapp Channel

fixes: #5782
This commit is contained in:
Sojan Jose
2022-11-24 11:50:32 +00:00
committed by GitHub
parent 606fc9046a
commit 8ea0660862
11 changed files with 148 additions and 7 deletions

View File

@@ -39,11 +39,14 @@ module Reauthorizable
def prompt_reauthorization!
::Redis::Alfred.set(reauthorization_required_key, true)
if (is_a? Integrations::Hook) && slack?
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).slack_disconnect.deliver_later
elsif is_a? Channel::FacebookPage
case self.class.name
when 'Integrations::Hook'
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).slack_disconnect.deliver_later if slack?
when 'Channel::FacebookPage'
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).facebook_disconnect(inbox).deliver_later
elsif is_a? Channel::Email
when 'Channel::Whatsapp'
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).whatsapp_disconnect(inbox).deliver_later
when 'Channel::Email'
AdministratorNotifications::ChannelNotificationsMailer.with(account: account).email_disconnect(inbox).deliver_later
end
end