correct regression where notifications scope is not pushing to push server

This commit is contained in:
Sam 2016-10-14 22:52:25 +11:00
parent bd1328c189
commit aaf947356b
2 changed files with 2 additions and 2 deletions

View File

@ -398,7 +398,7 @@ class PostAlerter
def push_notification(user, payload)
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) AND push_url IS NOT NULL AND position(push_url in ?) > 0 AND revoked_at IS NULL",
.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)
.pluck(:client_id, :push_url)

View File

@ -338,7 +338,7 @@ describe PostAlerter do
client_id: "xxx#{i}",
key: "yyy#{i}",
application_name: "iPhone#{i}",
scopes: ['push'],
scopes: ['notifications'],
push_url: "https://site2.com/push")
end