Skip to content

Commit

Permalink
backend: revert commit c730e6a
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Jul 1, 2024
1 parent 61662d9 commit 064456a
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions backend/src/helpers/SetTicketMessagesAsRead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,11 @@ const SetTicketMessagesAsRead = async (ticket: Ticket): Promise<void> => {
});
companyid = getJsonMessage[0]?.companyId;

getJsonMessage.map(async m => {
const message: proto.IWebMessageInfo = JSON.parse(m.dataJson);
if (message.key) {
await (wbot as WASocket).readMessages([message.key]);
}
});

if (getJsonMessage.length > 0) {
const lastMessages: proto.IWebMessageInfo = JSON.parse( getJsonMessage[0].dataJson );
const number:string = ticket.isGroup ? `${ticket.contact.number.substring(12,0)}-${ticket.contact.number.substring(12)}@g.us` : `${ticket.contact.number}@s.whatsapp.net`
const lastMessages: proto.IWebMessageInfo = JSON.parse(
JSON.stringify(getJsonMessage[0].dataJson)
);
const number = ticket.isGroup ? `${ticket.contact.number.substring(12,0)}-${ticket.contact.number.substring(12)}@g.us` : `${ticket.contact.number}@s.whatsapp.net`
if (lastMessages.key && lastMessages.key.fromMe === false) {
await (wbot as WASocket).chatModify(
{ markRead: true, lastMessages: [lastMessages] },
Expand Down

0 comments on commit 064456a

Please sign in to comment.