mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 04:39:20 +00:00
fix: receiving multiple messages crash unread messages count
This commit is contained in:
@@ -27,7 +27,7 @@ class Ticket extends Sequelize.Model {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.addHook("afterUpdate", async ticket => {
|
this.addHook("beforeUpdate", async ticket => {
|
||||||
ticket.unreadMessages = await Message.count({
|
ticket.unreadMessages = await Message.count({
|
||||||
where: { ticketId: ticket.id, read: false },
|
where: { ticketId: ticket.id, read: false },
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user