Skip to content

A platform for community discussion. Free, open, simple.

FIX: Do not send notification to empty push_url

Penar Musaraj48c123849228
diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rb
index 3fe1a8899a7..bcf1f053851 100644
--- a/app/services/post_alerter.rb
+++ b/app/services/post_alerter.rb
@@ -453,7 +453,7 @@ class PostAlerter
if SiteSetting.allow_user_api_key_scopes.split("|").include?("push") && SiteSetting.allowed_user_api_push_urls.present?
clients = user.user_api_keys
.where("('push' = ANY(scopes) OR 'notifications' = ANY(scopes))")
- .where("push_url IS NOT NULL")
+ .where("push_url IS NOT NULL AND push_url <> ''")
.where("position(push_url IN ?) > 0", SiteSetting.allowed_user_api_push_urls)
.where("revoked_at IS NULL")
.pluck(:client_id, :push_url)