mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 20:59:16 +00:00
improvement: mark ticket messages as read when ticket status change
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import AppError from "../../errors/AppError";
|
import AppError from "../../errors/AppError";
|
||||||
|
import SetTicketMessagesAsRead from "../../helpers/SetTicketMessagesAsRead";
|
||||||
import Contact from "../../models/Contact";
|
import Contact from "../../models/Contact";
|
||||||
import Ticket from "../../models/Ticket";
|
import Ticket from "../../models/Ticket";
|
||||||
import User from "../../models/User";
|
import User from "../../models/User";
|
||||||
@@ -40,6 +41,8 @@ const UpdateTicketService = async ({
|
|||||||
throw new AppError("No ticket found with this ID.", 404);
|
throw new AppError("No ticket found with this ID.", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await SetTicketMessagesAsRead(ticket);
|
||||||
|
|
||||||
const oldStatus = ticket.status;
|
const oldStatus = ticket.status;
|
||||||
|
|
||||||
await ticket.update({
|
await ticket.update({
|
||||||
|
|||||||
Reference in New Issue
Block a user