From ffa2b6108798de3cb4a8d1b889d9f1250dc38a7d Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 21 Aug 2019 14:55:26 +0200 Subject: [PATCH] Maintenance: Not having an active Email::Notification is a valid use case. --- lib/notification_factory/mailer.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/notification_factory/mailer.rb b/lib/notification_factory/mailer.rb index d4358abb6..36777c315 100644 --- a/lib/notification_factory/mailer.rb +++ b/lib/notification_factory/mailer.rb @@ -133,6 +133,12 @@ returns # get active Email::Outbound Channel and send channel = Channel.find_by(area: 'Email::Notification', active: true) + + if channel.blank? + Rails.logger.info "Can't find an active 'Email::Notification' channel. Canceling notification sending." + return + end + channel.deliver( { # in_reply_to: in_reply_to,