2016-09-24 11:00:46 +08:00
|
|
|
# frozen_string_literal: true
|
2016-04-24 11:50:35 -04:00
|
|
|
class ApplicationMailer < ActionMailer::Base
|
2016-07-26 08:14:23 +08:00
|
|
|
default from: 'team@metamaps.cc'
|
2016-04-24 11:50:35 -04:00
|
|
|
layout 'mailer'
|
2016-11-01 11:18:27 +08:00
|
|
|
|
|
|
|
def deliver
|
|
|
|
raise NotImplementedError('Please use Mailboxer to send your emails.')
|
|
|
|
end
|
2016-12-08 14:39:41 -05:00
|
|
|
|
|
|
|
class << self
|
|
|
|
def mail_for_notification(notification)
|
|
|
|
if notification.notification_code == MAILBOXER_CODE_ACCESS_REQUEST
|
|
|
|
request = notification.notified_object
|
|
|
|
MapMailer.access_request_email(request, request.map)
|
|
|
|
elsif notification.notification_code == MAILBOXER_CODE_INVITED_TO_EDIT
|
|
|
|
user_map = notification.notified_object
|
|
|
|
MapMailer.invite_to_edit_email(user_map.map, user_map.map.user, user_map.user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-04-24 11:50:35 -04:00
|
|
|
end
|