From dbce7465130e1d505f0b192eafaf334722ca64fa Mon Sep 17 00:00:00 2001 From: Claudemir Todo Bom Date: Sat, 6 Jul 2024 09:45:36 -0300 Subject: [PATCH] don't send completion and rating messages if disableBot --- .../src/services/TicketServices/UpdateTicketService.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/src/services/TicketServices/UpdateTicketService.ts b/backend/src/services/TicketServices/UpdateTicketService.ts index 2ab0d923..c9b03de6 100644 --- a/backend/src/services/TicketServices/UpdateTicketService.ts +++ b/backend/src/services/TicketServices/UpdateTicketService.ts @@ -80,7 +80,7 @@ const UpdateTicketService = async ({ if (tokenData && ticket.status !== "pending") { if ( tokenData.profile !== "admin" && - ticket.userId !== parseInt(tokenData.id) + ticket.userId !== parseInt(tokenData.id, 10) ) { throw new AppError( "Apenas o usuário ativo do ticket ou o Admin podem fazer alterações no ticket" @@ -114,7 +114,7 @@ const UpdateTicketService = async ({ companyId ); - if (setting?.value === "enabled") { + if (!ticket.contact.disableBot && setting?.value === "enabled") { if (ticketTraking.ratingAt == null && !justClose) { const ratingTxt = ratingMessage?.trim() || ""; let bodyRatingMessage = `\u200e${ratingTxt}\n\n`; @@ -150,7 +150,11 @@ const UpdateTicketService = async ({ ticketTraking.rated = false; } - if (!isNil(complationMessage) && complationMessage !== "") { + if ( + !ticket.contact.disableBot && + !isNil(complationMessage) && + complationMessage !== "" + ) { const body = `\u200e${complationMessage}`; if (ticket.channel === "whatsapp" && !ticket.isGroup) {