correct regression where notifications scope is not pushing to push server
This commit is contained in:
parent
bd1328c189
commit
aaf947356b
|
@ -398,7 +398,7 @@ class PostAlerter
|
||||||
def push_notification(user, payload)
|
def push_notification(user, payload)
|
||||||
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) 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)
|
SiteSetting.allowed_user_api_push_urls)
|
||||||
.pluck(:client_id, :push_url)
|
.pluck(:client_id, :push_url)
|
||||||
|
|
||||||
|
|
|
@ -338,7 +338,7 @@ describe PostAlerter do
|
||||||
client_id: "xxx#{i}",
|
client_id: "xxx#{i}",
|
||||||
key: "yyy#{i}",
|
key: "yyy#{i}",
|
||||||
application_name: "iPhone#{i}",
|
application_name: "iPhone#{i}",
|
||||||
scopes: ['push'],
|
scopes: ['notifications'],
|
||||||
push_url: "https://site2.com/push")
|
push_url: "https://site2.com/push")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue