about summary refs log tree commit diff
path: root/app/services/notify_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-29 01:30:32 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-29 01:30:32 +0100
commit3f075c7794ca7cc6e3c566591e9929859c6c325c (patch)
treefd649accdafbb57cf1ac5d7231dd44bd5dd447c8 /app/services/notify_service.rb
parent1992575d577bf5b4c408a0104ad310e17846466a (diff)
API for apps to register for push notifications
Diffstat (limited to 'app/services/notify_service.rb')
-rw-r--r--app/services/notify_service.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb
index 1ec36637c..d1504cadf 100644
--- a/app/services/notify_service.rb
+++ b/app/services/notify_service.rb
@@ -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