chore: Disable invalid contact resolved activity messages (#4253)
Fixes the bug which triggered "Contact resolved conversation" activity messages when snoozed conversations where reopened
This commit is contained in:
parent
771cb5b9fc
commit
f8c46341f6
2 changed files with 23 additions and 1 deletions
|
@ -87,6 +87,28 @@ RSpec.describe '/api/v1/widget/messages', type: :request do
|
|||
expect(response).to have_http_status(:success)
|
||||
expect(conversation.reload.resolved?).to eq(true)
|
||||
end
|
||||
|
||||
it 'does not create resolved activity messages when snoozed conversation is opened' do
|
||||
conversation.snoozed!
|
||||
|
||||
message_params = { content: 'hello world', timestamp: Time.current }
|
||||
post api_v1_widget_messages_url,
|
||||
params: { website_token: web_widget.website_token, message: message_params },
|
||||
headers: { 'X-Auth-Token' => token },
|
||||
as: :json
|
||||
|
||||
expect(Conversations::ActivityMessageJob).not_to have_been_enqueued.at_least(:once).with(
|
||||
conversation,
|
||||
{
|
||||
account_id: conversation.account_id,
|
||||
inbox_id: conversation.inbox_id,
|
||||
message_type: :activity,
|
||||
content: "Conversation was resolved by #{contact.name}"
|
||||
}
|
||||
)
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(conversation.reload.open?).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue