mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-30 02:32:29 +00:00
Show captain messages under the name of the assistant which generated the message. - Add support for `Captain::Assistant` sender type - Add push_event_data for captain_assistants - Add activity message handler for captain_assistants - Update UI to show captain messages under the name of the assistant - Fix the issue where openAI errors when image is sent - Add support for custom name of the assistant --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
26 lines
1.1 KiB
Ruby
26 lines
1.1 KiB
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe Message do
|
|
let!(:conversation) { create(:conversation) }
|
|
|
|
it 'updates first reply if the message is human and even if there are messages from captain' do
|
|
captain_assistant = create(:captain_assistant, account: conversation.account)
|
|
expect(conversation.first_reply_created_at).to be_nil
|
|
|
|
## There is a difference on how the time is stored in the database and how it is retrieved
|
|
# This is because of the precision of the time stored in the database
|
|
# In the test, we will check whether the time is within the range
|
|
expect(conversation.waiting_since).to be_within(0.000001.seconds).of(conversation.created_at)
|
|
|
|
create(:message, message_type: :outgoing, conversation: conversation, sender: captain_assistant)
|
|
|
|
expect(conversation.first_reply_created_at).to be_nil
|
|
expect(conversation.waiting_since).to be_within(0.000001.seconds).of(conversation.created_at)
|
|
|
|
create(:message, message_type: :outgoing, conversation: conversation)
|
|
|
|
expect(conversation.first_reply_created_at).not_to be_nil
|
|
expect(conversation.waiting_since).to be_nil
|
|
end
|
|
end
|