mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 12:19:16 +00:00
fix: tickets not disappearing for users that are not members of queue after queue assignment
This commit is contained in:
@@ -21,6 +21,7 @@ import CreateOrUpdateContactService from "../ContactServices/CreateOrUpdateConta
|
||||
import FindOrCreateTicketService from "../TicketServices/FindOrCreateTicketService";
|
||||
import ShowWhatsAppService from "../WhatsappService/ShowWhatsAppService";
|
||||
import { debounce } from "../../helpers/Debounce";
|
||||
import UpdateTicketService from "../TicketServices/UpdateTicketService";
|
||||
|
||||
interface Session extends Client {
|
||||
id?: number;
|
||||
@@ -137,8 +138,11 @@ const verifyQueue = async (
|
||||
const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!);
|
||||
|
||||
if (queues.length === 1) {
|
||||
await ticket.$set("queue", queues[0]);
|
||||
// TODO sendTicketQueueUpdate to frontend
|
||||
// await ticket.$set("queue", queues[0].id);
|
||||
await UpdateTicketService({
|
||||
ticketData: { queueId: queues[0].id },
|
||||
ticketId: ticket.id
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -148,15 +152,16 @@ const verifyQueue = async (
|
||||
const choosenQueue = queues[+selectedOption - 1];
|
||||
|
||||
if (choosenQueue) {
|
||||
await ticket.$set("queue", choosenQueue);
|
||||
await UpdateTicketService({
|
||||
ticketData: { queueId: choosenQueue.id },
|
||||
ticketId: ticket.id
|
||||
});
|
||||
|
||||
const body = `\u200e${choosenQueue.greetingMessage}`;
|
||||
|
||||
const sentMessage = await wbot.sendMessage(`${contact.number}@c.us`, body);
|
||||
|
||||
await verifyMessage(sentMessage, ticket, contact);
|
||||
|
||||
// TODO sendTicketQueueUpdate to frontend
|
||||
} else {
|
||||
let options = "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user