fix: Include waiting on agent conversations to unattended view (#7667)

Updating the `unattended` tab to include conversations where the customer responded and is awaiting an agent's response.

Previously it showed only the conversations where the first response was pending.

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sojan Jose
2023-08-15 15:09:10 -07:00
committed by GitHub
parent 310c127693
commit e3b8c1fbb5
7 changed files with 90 additions and 51 deletions

View File

@@ -25,10 +25,11 @@ export const filterByLabel = (shouldFilter, labels, chatLabels) => {
export const filterByUnattended = (
shouldFilter,
conversationType,
firstReplyOn
firstReplyOn,
waitingSince
) => {
return conversationType === 'unattended'
? !firstReplyOn && shouldFilter
? (!firstReplyOn || !!waitingSince) && shouldFilter
: shouldFilter;
};
@@ -40,6 +41,7 @@ export const applyPageFilters = (conversation, filters) => {
labels: chatLabels = [],
meta = {},
first_reply_created_at: firstReplyOn,
waiting_since: waitingSince,
} = conversation;
const team = meta.team || {};
const { id: chatTeamId } = team;
@@ -51,7 +53,8 @@ export const applyPageFilters = (conversation, filters) => {
shouldFilter = filterByUnattended(
shouldFilter,
conversationType,
firstReplyOn
firstReplyOn,
waitingSince
);
return shouldFilter;