mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 03:39:29 +00:00
fix: deleting a ticket with unreadMessages keeps ticket in notifications
This commit is contained in:
@@ -101,6 +101,7 @@ export const remove = async (
|
||||
const io = getIO();
|
||||
io.to(ticket.status)
|
||||
.to(ticketId)
|
||||
.to("notification")
|
||||
.emit("ticket", {
|
||||
action: "delete",
|
||||
ticketId: +ticketId
|
||||
|
||||
@@ -73,7 +73,7 @@ const NotificationsPopOver = () => {
|
||||
socket.emit("joinNotification");
|
||||
|
||||
socket.on("ticket", data => {
|
||||
if (data.action === "updateUnread") {
|
||||
if (data.action === "updateUnread" || data.action === "delete") {
|
||||
setNotifications(prevState => {
|
||||
const ticketIndex = prevState.findIndex(t => t.id === data.ticketId);
|
||||
if (ticketIndex !== -1) {
|
||||
@@ -103,7 +103,7 @@ const NotificationsPopOver = () => {
|
||||
(ticketIdRef.current &&
|
||||
data.message.ticketId === ticketIdRef.current &&
|
||||
document.visibilityState === "visible") ||
|
||||
(data.ticket.userId !== userId && data.ticket.userId)
|
||||
(data.ticket.userId && data.ticket.userId !== userId)
|
||||
)
|
||||
return;
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user