Browse Source

Maintenance: Not having an active Email::Notification is a valid use case.

Thorsten Eckel 5 years ago
parent
commit
ffa2b61087
1 changed files with 6 additions and 0 deletions
  1. 6 0
      lib/notification_factory/mailer.rb

+ 6 - 0
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,