fix: Disable typing indicator for user when agent is typing a private note (#3303)
This commit is contained in:
@@ -405,12 +405,24 @@ RSpec.describe 'Conversations API', type: :request do
|
||||
allow(Rails.configuration.dispatcher).to receive(:dispatch)
|
||||
post "/api/v1/accounts/#{account.id}/conversations/#{conversation.display_id}/toggle_typing_status",
|
||||
headers: agent.create_new_auth_token,
|
||||
params: { typing_status: 'on' },
|
||||
params: { typing_status: 'on', is_private: false },
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
||||
.with(Conversation::CONVERSATION_TYPING_ON, kind_of(Time), { conversation: conversation, user: agent })
|
||||
.with(Conversation::CONVERSATION_TYPING_ON, kind_of(Time), { conversation: conversation, user: agent, is_private: false })
|
||||
end
|
||||
|
||||
it 'toggles the conversation status for private notes' do
|
||||
allow(Rails.configuration.dispatcher).to receive(:dispatch)
|
||||
post "/api/v1/accounts/#{account.id}/conversations/#{conversation.display_id}/toggle_typing_status",
|
||||
headers: agent.create_new_auth_token,
|
||||
params: { typing_status: 'on', is_private: true },
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
||||
.with(Conversation::CONVERSATION_TYPING_ON, kind_of(Time), { conversation: conversation, user: agent, is_private: true })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ describe ActionCableListener do
|
||||
|
||||
describe '#typing_on' do
|
||||
let(:event_name) { :'conversation.typing_on' }
|
||||
let!(:event) { Events::Base.new(event_name, Time.zone.now, conversation: conversation, user: agent) }
|
||||
let!(:event) { Events::Base.new(event_name, Time.zone.now, conversation: conversation, user: agent, is_private: false) }
|
||||
|
||||
it 'sends message to account admins, inbox agents and the contact' do
|
||||
# HACK: to reload conversation inbox members
|
||||
@@ -43,7 +43,8 @@ describe ActionCableListener do
|
||||
[admin.pubsub_token, conversation.contact.pubsub_token],
|
||||
'conversation.typing_on', conversation: conversation.push_event_data,
|
||||
user: agent.push_event_data,
|
||||
account_id: account.id
|
||||
account_id: account.id,
|
||||
is_private: false
|
||||
)
|
||||
listener.conversation_typing_on(event)
|
||||
end
|
||||
@@ -51,7 +52,7 @@ describe ActionCableListener do
|
||||
|
||||
describe '#typing_off' do
|
||||
let(:event_name) { :'conversation.typing_off' }
|
||||
let!(:event) { Events::Base.new(event_name, Time.zone.now, conversation: conversation, user: agent) }
|
||||
let!(:event) { Events::Base.new(event_name, Time.zone.now, conversation: conversation, user: agent, is_private: false) }
|
||||
|
||||
it 'sends message to account admins, inbox agents and the contact' do
|
||||
# HACK: to reload conversation inbox members
|
||||
@@ -60,7 +61,8 @@ describe ActionCableListener do
|
||||
[admin.pubsub_token, conversation.contact.pubsub_token],
|
||||
'conversation.typing_off', conversation: conversation.push_event_data,
|
||||
user: agent.push_event_data,
|
||||
account_id: account.id
|
||||
account_id: account.id,
|
||||
is_private: false
|
||||
)
|
||||
listener.conversation_typing_off(event)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user