From 238a13643d15346ea3295f51d0e36630db3150e9 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 17 May 2018 12:52:01 +0530 Subject: [PATCH] FIX: handle missing users when sending push notifications --- app/jobs/regular/send_push_notification.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/regular/send_push_notification.rb b/app/jobs/regular/send_push_notification.rb index c27f1bbf278..355e2465cbf 100644 --- a/app/jobs/regular/send_push_notification.rb +++ b/app/jobs/regular/send_push_notification.rb @@ -1,8 +1,8 @@ module Jobs class SendPushNotification < Jobs::Base def execute(args) - user = User.find(args[:user_id]) - PushNotificationPusher.push(user, args[:payload]) + user = User.find_by(id: args[:user_id]) + PushNotificationPusher.push(user, args[:payload]) if user end end end