API for apps to register for push notifications
This commit is contained in:
parent
1992575d57
commit
3f075c7794
13 changed files with 112 additions and 2 deletions
|
@ -10,6 +10,7 @@ class NotifyService < BaseService
|
|||
|
||||
create_notification
|
||||
send_email if email_enabled?
|
||||
send_push_notification
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
return
|
||||
end
|
||||
|
@ -57,6 +58,10 @@ class NotifyService < BaseService
|
|||
NotificationMailer.send(@notification.type, @recipient, @notification).deliver_later
|
||||
end
|
||||
|
||||
def send_push_notification
|
||||
PushNotificationWorker.perform_async(@notification.id)
|
||||
end
|
||||
|
||||
def email_enabled?
|
||||
@recipient.user.settings.notification_emails[@notification.type]
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue