2020-10-27 18:52:57 +00:00
|
|
|
class AdministratorNotifications::ChannelNotificationsMailer < ApplicationMailer
|
2021-08-01 12:45:39 +00:00
|
|
|
def slack_disconnect
|
2020-10-27 18:52:57 +00:00
|
|
|
return unless smtp_config_set_or_development?
|
|
|
|
|
|
|
|
subject = 'Your Slack integration has expired'
|
2022-07-15 02:51:59 +00:00
|
|
|
@action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/integrations/slack"
|
2021-08-01 12:45:39 +00:00
|
|
|
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'
|
2022-07-15 02:51:59 +00:00
|
|
|
@action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}"
|
2021-08-01 12:45:39 +00:00
|
|
|
send_mail_with_liquid(to: admin_emails, subject: subject) and return
|
|
|
|
end
|
|
|
|
|
2022-03-22 06:44:17 +00:00
|
|
|
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'
|
2022-07-15 02:51:59 +00:00
|
|
|
@action_url = "#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{Current.account.id}/settings/inboxes/#{inbox.id}"
|
2022-03-22 06:44:17 +00:00
|
|
|
send_mail_with_liquid(to: admin_emails, subject: subject) and return
|
|
|
|
end
|
|
|
|
|
2021-08-01 12:45:39 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def admin_emails
|
|
|
|
Current.account.administrators.pluck(:email)
|
2020-10-27 18:52:57 +00:00
|
|
|
end
|
|
|
|
end
|