diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rb index 3d9aeed20d8..00e27ab3727 100644 --- a/app/services/post_alerter.rb +++ b/app/services/post_alerter.rb @@ -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) diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rb index 2583e10430f..48689faae4f 100644 --- a/spec/services/post_alerter_spec.rb +++ b/spec/services/post_alerter_spec.rb @@ -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