Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Jul 1, 2024
1 parent 2e5147d commit 7a07606
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions backend/src/helpers/SetTicketMessagesAsRead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ const SetTicketMessagesAsRead = async (ticket: Ticket): Promise<void> => {
});

if (getJsonMessage.length > 0) {
const lastMessages: proto.IWebMessageInfo = JSON.parse( getJsonMessage[0].dataJson );
const lastMessages: proto.IWebMessageInfo = JSON.parse(
getJsonMessage[0].dataJson
);
if (lastMessages.key && lastMessages.key.fromMe === false) {
await (wbot as WASocket).chatModify(
{ markRead: true, lastMessages: [lastMessages] },
`${ticket.contact.number}@${ticket.isGroup ? "g.us" : "s.whatsapp.net"}`
`${ticket.contact.number}@${
ticket.isGroup ? "g.us" : "s.whatsapp.net"
}`
);
}
}
Expand All @@ -57,11 +61,14 @@ const SetTicketMessagesAsRead = async (ticket: Ticket): Promise<void> => {
}

const io = getIO();
if (companyid){
io.to(`company-${companyid}-mainchannel`).emit(`company-${companyid}-ticket`, {
action: "updateUnread",
ticketId: ticket?.id
});
if (companyid) {
io.to(`company-${companyid}-mainchannel`).emit(
`company-${companyid}-ticket`,
{
action: "updateUnread",
ticketId: ticket?.id
}
);
}

io.to(ticket.status).to("notification").emit("ticket", {
Expand Down

0 comments on commit 7a07606

Please sign in to comment.