FIX: Do not send notification to empty push_url

Completes e4424d7
This commit is contained in:
Penar Musaraj 2019-10-16 11:27:07 -04:00
parent d6118c8bc8
commit 48c1238492
1 changed files with 1 additions and 1 deletions

View File

@ -453,7 +453,7 @@ class PostAlerter
if SiteSetting.allow_user_api_key_scopes.split("|").include?("push") && SiteSetting.allowed_user_api_push_urls.present? if SiteSetting.allow_user_api_key_scopes.split("|").include?("push") && SiteSetting.allowed_user_api_push_urls.present?
clients = user.user_api_keys clients = user.user_api_keys
.where("('push' = ANY(scopes) OR 'notifications' = ANY(scopes))") .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("position(push_url IN ?) > 0", SiteSetting.allowed_user_api_push_urls)
.where("revoked_at IS NULL") .where("revoked_at IS NULL")
.pluck(:client_id, :push_url) .pluck(:client_id, :push_url)