mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-02 00:05:39 +08:00
## Summary - Unifies the two parallel push notification delivery paths (web push via VAPID and hub/native app relay) into a single `DeliverPushNotification` job - Extracts hub push delivery into `HubPushNotificationPusher` service, symmetric with the existing `PushNotificationPusher` for web push - Adds `UserApiKey.push_clients_for(user)` to encapsulate hub client lookup previously inlined in PostAlerter - Simplifies `PostAlerter.push_notification()` from two parallel enqueue blocks to a single call - Converts old jobs (`SendPushNotification`, `PushNotification`) to thin delegators for Sidekiq backward compatibility with in-flight jobs ## Test plan - [ ] `bin/rspec spec/jobs/deliver_push_notification_spec.rb` — new unified job tests - [ ] `bin/rspec spec/services/hub_push_notification_pusher_spec.rb` — new hub pusher tests - [ ] `bin/rspec spec/jobs/send_push_notification_spec.rb spec/jobs/push_notification_spec.rb` — backward compat delegation - [ ] `bin/rspec spec/services/post_alerter_spec.rb` — PostAlerter integration - [ ] `bin/rspec spec/services/push_notification_pusher_spec.rb` — web push unchanged - [ ] `bin/rspec plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb plugins/chat/spec/jobs/regular/chat/notify_mentioned_spec.rb` — chat plugin callers
12 lines
390 B
Ruby
12 lines
390 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe Jobs::SendPushNotification do
|
|
fab!(:user)
|
|
let(:payload) { { notification_type: 1, excerpt: "Hello you" } }
|
|
|
|
it "delegates to DeliverPushNotification" do
|
|
args = { user_id: user.id, payload: payload }
|
|
Jobs::DeliverPushNotification.any_instance.expects(:execute).with(args)
|
|
Jobs::SendPushNotification.new.execute(args)
|
|
end
|
|
end
|