fix: Move contact events to account stream rather than individual user stream (#11082)
This commit is contained in:
@@ -2,6 +2,8 @@ require 'rails_helper'
|
||||
|
||||
RSpec.describe RoomChannel do
|
||||
let!(:contact_inbox) { create(:contact_inbox) }
|
||||
let!(:account) { create(:account) }
|
||||
let!(:user) { create(:user, account: account) }
|
||||
|
||||
before do
|
||||
stub_connection
|
||||
@@ -12,4 +14,11 @@ RSpec.describe RoomChannel do
|
||||
expect(subscription).to be_confirmed
|
||||
expect(subscription).to have_stream_for(contact_inbox.pubsub_token)
|
||||
end
|
||||
|
||||
it 'subscribes to a stream when pubsub_token is provided for user' do
|
||||
subscribe(user_id: user.id, pubsub_token: user.pubsub_token, account_id: account.id)
|
||||
expect(subscription).to be_confirmed
|
||||
expect(subscription).to have_stream_for(user.pubsub_token)
|
||||
expect(subscription).to have_stream_for("account_#{account.id}")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,9 +121,7 @@ describe ActionCableListener do
|
||||
|
||||
it 'sends message to account admins, inbox agents' do
|
||||
expect(ActionCableBroadcastJob).to receive(:perform_later).with(
|
||||
a_collection_containing_exactly(
|
||||
agent.pubsub_token, admin.pubsub_token
|
||||
),
|
||||
["account_#{account.id}"],
|
||||
'contact.deleted',
|
||||
contact.push_event_data.merge(account_id: account.id)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user