b740fef8fe
* data prepared, task setup * add the basics of the email template * cover granular permissions * unfollow this map * break out permissions tests better * rename so test runs
30 lines
1.1 KiB
Ruby
30 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
class ApplicationMailer < ActionMailer::Base
|
|
default from: 'team@metamaps.cc'
|
|
layout 'mailer'
|
|
|
|
class << self
|
|
def mail_for_notification(notification)
|
|
case notification.notification_code
|
|
when MAP_ACCESS_REQUEST
|
|
request = notification.notified_object
|
|
MapMailer.access_request(request)
|
|
when MAP_ACCESS_APPROVED
|
|
request = notification.notified_object
|
|
MapMailer.access_approved(request)
|
|
when MAP_INVITE_TO_EDIT
|
|
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])
|
|
end
|
|
end
|
|
end
|
|
end
|