feat: Add a view for unattended conversations (#5890)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Nithin David Thomas
2022-11-29 08:18:00 -08:00
committed by GitHub
co-authored by Pranav Raj S
parent c94ba16565
commit 85b52a1d3f
20 changed files with 174 additions and 32 deletions
@@ -53,7 +53,7 @@ RSpec.describe 'Conversations API', type: :request do
get "/api/v1/accounts/#{account.id}/conversations",
headers: agent_1.create_new_auth_token,
params: { reply_status: 'unattended' },
params: { conversation_type: 'unattended' },
as: :json
expect(response).to have_http_status(:success)
+10
View File
@@ -136,5 +136,15 @@ describe ::ConversationFinder do
expect(result[:conversations].length).to be 25
end
end
context 'with unattended' do
let(:params) { { status: 'open', assignee_type: 'me', conversation_type: 'unattended' } }
it 'returns unattended conversations' do
create_list(:conversation, 25, account: account, inbox: inbox, assignee: user_1)
result = conversation_finder.perform
expect(result[:conversations].length).to be 25
end
end
end
end
+1
View File
@@ -455,6 +455,7 @@ RSpec.describe Conversation, type: :model do
channel: 'Channel::WebWidget',
snoozed_until: conversation.snoozed_until,
custom_attributes: conversation.custom_attributes,
first_reply_created_at: nil,
contact_last_seen_at: conversation.contact_last_seen_at.to_i,
agent_last_seen_at: conversation.agent_last_seen_at.to_i,
unread_count: 0
@@ -27,6 +27,7 @@ RSpec.describe Conversations::EventDataPresenter do
timestamp: conversation.last_activity_at.to_i,
snoozed_until: conversation.snoozed_until,
custom_attributes: conversation.custom_attributes,
first_reply_created_at: nil,
contact_last_seen_at: conversation.contact_last_seen_at.to_i,
agent_last_seen_at: conversation.agent_last_seen_at.to_i,
unread_count: 0