metamaps--metamaps/app/mailers/application_mailer.rb

31 lines
1.1 KiB
Ruby
Raw Normal View History

2016-09-24 03:00:46 +00:00
# frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base
default from: 'team@metamaps.cc'
layout 'mailer'
2016-12-08 19:39:41 +00:00
class << self
def mail_for_notification(notification)
2017-02-09 21:53:19 +00:00
case notification.notification_code
when MAP_ACCESS_REQUEST
2017-02-09 21:53:19 +00:00
request = notification.notified_object
MapMailer.access_request(request)
when MAP_ACCESS_APPROVED
2017-02-09 21:53:19 +00:00
request = notification.notified_object
MapMailer.access_approved(request)
when MAP_INVITE_TO_EDIT
2017-02-09 21:53:19 +00:00
user_map = notification.notified_object
MapMailer.invite_to_edit(user_map)
when TOPIC_ADDED_TO_MAP
event = notification.notified_object
TopicMailer.added_to_map(event, notification.recipients[0])
when TOPIC_CONNECTED_1
synapse = notification.notified_object
TopicMailer.connected(synapse, synapse.topic1, notification.recipients[0])
when TOPIC_CONNECTED_2
synapse = notification.notified_object
TopicMailer.connected(synapse, synapse.topic2, notification.recipients[0])
2016-12-08 19:39:41 +00:00
end
end
end
end