mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 03:39:29 +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({
|
||||
where: { ticketId: ticket.id, read: false },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user