From 33b3653809766191df48f8c9692a846e895eac72 Mon Sep 17 00:00:00 2001 From: oleghasjanov Date: Wed, 17 Apr 2024 13:57:35 +0300 Subject: [PATCH] prevent offer nil issue in webpush --- .gitignore | 4 +++- app/controllers/concerns/offer_notifable.rb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5271d5e10..4d9ffc5f8 100644 --- a/.gitignore +++ b/.gitignore @@ -54,4 +54,6 @@ yarn-debug.log* /public/assets/ /public/assets/builds public/assets/builds/* -app/assets/builds/* \ No newline at end of file +app/assets/builds/* + +.DS_Store \ No newline at end of file diff --git a/app/controllers/concerns/offer_notifable.rb b/app/controllers/concerns/offer_notifable.rb index 2f650e31b..39e0e96ff 100644 --- a/app/controllers/concerns/offer_notifable.rb +++ b/app/controllers/concerns/offer_notifable.rb @@ -5,7 +5,8 @@ def send_outbided_notification(auction:, offer:, flash:) participant_id = last_higher_bidder(auction) participant = User.find(participant_id) - OfferNotification.with(offer: offer).deliver_later(participant) + OfferNotification.with(offer: offer).deliver_later(participant) if offer.present? + flash[:notice] = "websocket_domain_name, #{auction.domain_name}" broadcast_outbid_to_notifications(participant: participant, flash: flash) end