message from devs notification type
This commit is contained in:
parent
575a3ec8bf
commit
e5846abf01
2 changed files with 9 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
class NotificationService
|
||||
# for strip_tags
|
||||
include ActionView::Helpers::SanitizeHelper
|
||||
|
||||
def self.renderer
|
||||
renderer ||= ApplicationController.renderer.new(
|
||||
http_host: ENV['MAILER_DEFAULT_URL'],
|
||||
|
@ -25,14 +28,16 @@ class NotificationService
|
|||
|
||||
def self.text_for_notification(notification)
|
||||
if notification.notification_code == MAILBOXER_CODE_ACCESS_REQUEST
|
||||
map = notification.notified_object.map
|
||||
map = notification.notified_object&.map
|
||||
'wants permission to map with you on <span class="in-bold">' + map.name + '</span> <div class="action">Offer a response</div>'
|
||||
elsif notification.notification_code == MAILBOXER_CODE_ACCESS_APPROVED
|
||||
map = notification.notified_object.map
|
||||
map = notification.notified_object&.map
|
||||
'granted your request to edit map <span class="in-bold">' + map.name + '</span>'
|
||||
elsif notification.notification_code == MAILBOXER_CODE_INVITE_TO_EDIT
|
||||
map = notification.notified_object.map
|
||||
map = notification.notified_object&.map
|
||||
'gave you edit access to map <span class="in-bold">' + map.name + '</span>'
|
||||
elsif notification.notification_code == MAILBOXER_CODE_MESSAGE_FROM_DEVS
|
||||
strip_tags(notification.body).truncate(70)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
MAILBOXER_CODE_ACCESS_REQUEST = 'ACCESS_REQUEST'
|
||||
MAILBOXER_CODE_ACCESS_APPROVED = 'ACCESS_APPROVED'
|
||||
MAILBOXER_CODE_INVITE_TO_EDIT = 'INVITE_TO_EDIT'
|
||||
MAILBOXER_CODE_MESSAGE_FROM_DEVS = 'MESSAGE_FROM_DEVS'
|
||||
|
||||
Mailboxer.setup do |config|
|
||||
# Configures if your application uses or not email sending for Notifications and Messages
|
||||
|
|
Loading…
Add table
Reference in a new issue