about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-29 12:25:10 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-29 12:25:10 +0100
commit83ccdeb87a6d9cd9b506707be8814cc7a0f242d2 (patch)
tree6a80bfeeaf5a642b976fd15609833de47026bbd6 /app/services
parent3f075c7794ca7cc6e3c566591e9929859c6c325c (diff)
Fix tests
Diffstat (limited to 'app/services')
-rw-r--r--app/services/send_push_notification_service.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/services/send_push_notification_service.rb b/app/services/send_push_notification_service.rb
index 802614fce..526ae20cb 100644
--- a/app/services/send_push_notification_service.rb
+++ b/app/services/send_push_notification_service.rb
@@ -2,13 +2,13 @@
 
 class SendPushNotificationService < BaseService
   def call(notification)
-  	return if ENV['FCM_API_KEY'].blank?
+    return if ENV['FCM_API_KEY'].blank?
 
-  	devices = Device.where(account: notification.account).pluck(:registration_id)
-  	fcm     = FCM.new(ENV['FCM_API_KEY'])
+    devices = Device.where(account: notification.account).pluck(:registration_id)
+    fcm     = FCM.new(ENV['FCM_API_KEY'])
 
-  	response = fcm.send(devices, data: { notification_id: notification.id }, collapse_key: :notifications, priority: :high)
-  	handle_response(response)
+    response = fcm.send(devices, data: { notification_id: notification.id }, collapse_key: :notifications, priority: :high)
+    handle_response(response)
   end
 
   private
@@ -19,10 +19,10 @@ class SendPushNotificationService < BaseService
   end
 
   def update_canonical_ids(ids)
-  	ids.each { |pair| Device.find_by(registration_id: pair[:old]).update(registration_id: pair[:new]) }
+    ids.each { |pair| Device.find_by(registration_id: pair[:old]).update(registration_id: pair[:new]) }
   end
 
   def remove_bad_ids(bad_ids)
-  	Device.where(registration_id: bad_ids).delete_all
+    Device.where(registration_id: bad_ids).delete_all unless bad_ids.empty?
   end
 end