FIX: ensure 'notifications_state' is up to date after creating a notification

This commit is contained in:
Régis Hanol
2018-05-26 02:09:48 +02:00
parent cc0a5f4526
commit f988fa31aa
6 changed files with 61 additions and 66 deletions
+4 -2
View File
@@ -425,8 +425,10 @@ 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)) AND push_url IS NOT NULL AND position(push_url in ?) > 0 AND revoked_at IS NULL",
SiteSetting.allowed_user_api_push_urls)
.where("('push' = ANY(scopes) OR 'notifications' = ANY(scopes))")
.where("push_url IS NOT NULL")
.where("position(push_url IN ?) > 0", SiteSetting.allowed_user_api_push_urls)
.where("revoked_at IS NULL")
.pluck(:client_id, :push_url)
if clients.length > 0