Module: Services::MdsNotifications
- Included in:
- MdsUpload
- Defined in:
- app/roles/services/mds_notifications.rb
Instance Method Summary collapse
- #handle_mds_notifications ⇒ Object
- #notify_the_uploader? ⇒ Boolean
- #send_upload_confirmation(notification_email = nil) ⇒ Object
Instance Method Details
#handle_mds_notifications ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/roles/services/mds_notifications.rb', line 5 def handle_mds_notifications logger.info "Fixing to notify the uploader: #{notify_the_uploader?}" self.send_upload_confirmation if notify_the_uploader? notification_type = self.account.mds_notification_type return if notification_type == MdsNotification::NOTIFY_NONE if notification_type == MdsNotification::NOTIFY_WHEN_UPLOADED logger.info "Notifying for all uploads" self.send_upload_confirmation(self.account.mds_notification_email) else # DS: Notice that an immediate account email will be sent out even if the notification # type is set to NOTIFY_DAILY_DIGEST. THERE IS A REASON FOR THIS. Most accounts do not # want to wait for the digest to be sent out to learn that there was an MDS upload error. # These things don't happen very often, so it shouldn't be a major imposition to recieve # these error emails. # # SO. DON'T CHANGE THIS UNLESS YOU HAVE BEEN EXPLICITLY ASKED TO CHANGE IT. I may have # made a mistake here, but it was an _intentional_ mistake. # # Enjoy the rest of your day. logger.info "Notifying for error uploads" self.send_upload_confirmation(self.account.mds_notification_email) if has_errors? end end |
#notify_the_uploader? ⇒ Boolean
32 33 34 35 36 |
# File 'app/roles/services/mds_notifications.rb', line 32 def notify_the_uploader? self.notify_uploader? && self.upload_user.present? && self.upload_user.email.present? end |
#send_upload_confirmation(notification_email = nil) ⇒ Object
38 39 40 |
# File 'app/roles/services/mds_notifications.rb', line 38 def send_upload_confirmation(notification_email=nil) MDS_NOTIFICATION_MAILER.notify_mds_uploaded(self, notification_email).deliver end |