Chatwoot/app/mailers/administrator_notifications/channel_notifications_mailer.rb
Sojan Jose 8ea0660862
chore: Add reauthorization prompt for Whatsapp Channel (#5929)
- Add reauthorization prompt for Whatsapp Channel

fixes: #5782
2022-11-24 14:50:32 +03:00

39 lines
1.5 KiB
Ruby

class AdministratorNotifications::ChannelNotificationsMailer < ApplicationMailer
def slack_disconnect
return unless smtp_config_set_or_development?
subject = 'Your Slack integration has expired'
@action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/integrations/slack"
send_mail_with_liquid(to: admin_emails, subject: subject) and return
end
def facebook_disconnect(inbox)
return unless smtp_config_set_or_development?
subject = 'Your Facebook page connection has expired'
@action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}"
send_mail_with_liquid(to: admin_emails, subject: subject) and return
end
def whatsapp_disconnect(inbox)
return unless smtp_config_set_or_development?
subject = 'Your Whatsapp connection has expired'
@action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}"
send_mail_with_liquid(to: admin_emails, subject: subject) and return
end
def email_disconnect(inbox)
return unless smtp_config_set_or_development?
subject = 'Your email inbox has been disconnected. Please update the credentials for SMTP/IMAP'
@action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}"
send_mail_with_liquid(to: admin_emails, subject: subject) and return
end
private
def admin_emails
Current.account.administrators.pluck(:email)
end
end