mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-19 04:09:26 +00:00
fix: tickets not disappearing for users that are not members of queue after queue assignment
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { getIO } from "../libs/socket";
|
||||
import Ticket from "../models/Ticket";
|
||||
import UpdateTicketService from "../services/TicketServices/UpdateTicketService";
|
||||
|
||||
@@ -8,23 +7,10 @@ const UpdateDeletedUserOpenTicketsStatus = async (
|
||||
tickets.forEach(async t => {
|
||||
const ticketId = t.id.toString();
|
||||
|
||||
const { ticket, oldStatus } = await UpdateTicketService({
|
||||
await UpdateTicketService({
|
||||
ticketData: { status: "pending" },
|
||||
ticketId
|
||||
});
|
||||
|
||||
const io = getIO();
|
||||
if (ticket.status !== oldStatus) {
|
||||
io.to(oldStatus).emit("ticket", {
|
||||
action: "delete",
|
||||
ticketId: ticket.id
|
||||
});
|
||||
}
|
||||
|
||||
io.to(ticket.status).to(ticketId).emit("ticket", {
|
||||
action: "updateStatus",
|
||||
ticket
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user