fix: tickets not disappearing for users that are not members of queue after queue assignment

This commit is contained in:
canove
2021-01-14 12:20:41 -03:00
parent 2cc7b4e508
commit f7f0b01eb3
6 changed files with 41 additions and 38 deletions

View File

@@ -187,6 +187,9 @@ const TicketsList = ({ status, searchParam, showAll, selectedQueueIds }) => {
(!ticket.userId || ticket.userId === user?.id || showAll) &&
(!ticket.queueId || selectedQueueIds.indexOf(ticket.queueId) > -1);
const notBelongsToUserQueues = ticket =>
selectedQueueIds.indexOf(ticket.queueId) === -1;
socket.on("connect", () => {
if (status) {
socket.emit("joinTickets", status);
@@ -210,6 +213,10 @@ const TicketsList = ({ status, searchParam, showAll, selectedQueueIds }) => {
});
}
if (data.action === "update" && notBelongsToUserQueues(data.ticket)) {
dispatch({ type: "DELETE_TICKET", payload: data.ticket.id });
}
if (data.action === "delete") {
dispatch({ type: "DELETE_TICKET", payload: data.ticketId });
}