2016-09-24 03:00:46 +00:00
|
|
|
# frozen_string_literal: true
|
2016-04-24 15:50:35 +00:00
|
|
|
class ApplicationMailer < ActionMailer::Base
|
2016-07-26 00:14:23 +00:00
|
|
|
default from: 'team@metamaps.cc'
|
2016-04-24 15:50:35 +00:00
|
|
|
layout 'mailer'
|
2016-11-25 20:57:12 +00:00
|
|
|
|
|
|
|
def deliver
|
2016-11-28 17:54:33 +00:00
|
|
|
raise NotImplementedError('Please use Mailboxer to send your emails.')
|
2016-11-25 20:57:12 +00:00
|
|
|
end
|
2016-12-08 21:22:43 +00:00
|
|
|
|
|
|
|
class << self
|
|
|
|
def mail_for_notification(notification)
|
|
|
|
if notification.notification_code == MAILBOXER_CODE_ACCESS_REQUEST
|
|
|
|
request = notification.notified_object
|
2016-12-13 07:42:33 +00:00
|
|
|
MapMailer.access_request_email(request)
|
|
|
|
elsif notification.notification_code == MAILBOXER_CODE_ACCESS_APPROVED
|
|
|
|
request = notification.notified_object
|
|
|
|
MapMailer.access_approved_email(request)
|
|
|
|
elsif notification.notification_code == MAILBOXER_CODE_INVITE_TO_EDIT
|
2016-12-08 21:48:50 +00:00
|
|
|
user_map = notification.notified_object
|
|
|
|
MapMailer.invite_to_edit_email(user_map.map, user_map.map.user, user_map.user)
|
2016-12-08 21:22:43 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-04-24 15:50:35 +00:00
|
|
|
end
|