A platform for community discussion. Free, open, simple.
FIX: Use newly created PushSubscription object for push test message (#13293)
Rafael dos Santos Silvaee6ff9f1d7c8
diff --git a/app/services/push_notification_pusher.rb b/app/services/push_notification_pusher.rbindex 72000de01e6..3e56da4431c 100644--- a/app/services/push_notification_pusher.rb+++ b/app/services/push_notification_pusher.rb@@ -35,12 +35,12 @@ class PushNotificationPusheruser.push_subscriptions.clearend- def self.subscribe(user, subscription, send_confirmation)- data = subscription.to_json+ def self.subscribe(user, push_params, send_confirmation)+ data = push_params.to_jsonsubscriptions = PushSubscription.where(user: user, data: data)subscriptions_count = subscriptions.count- if subscriptions_count > 1+ new_subscription = if subscriptions_count > 1subscriptions.destroy_allPushSubscription.create!(user: user, data: data)elsif subscriptions_count == 0@@ -57,7 +57,7 @@ class PushNotificationPushertag: "#{Discourse.current_hostname}-subscription"}- send_notification(user, subscription, message)+ send_notification(user, new_subscription, message)endend