Skip to content

Commit

Permalink
fix regression from commit 9718eea
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Oct 21, 2024
1 parent 9718eea commit 90c4d6f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions backend/src/services/WbotServices/SendWhatsAppMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { exec } from "child_process";
import path from "path";
import ffmpegPath from "@ffmpeg-installer/ffmpeg";
import mime from "mime-types";
import iconv from 'iconv-lite';
import iconv from "iconv-lite";
import AppError from "../../errors/AppError";
import GetTicketWbot from "../../helpers/GetTicketWbot";
import Ticket from "../../models/Ticket";
import { verifyMediaMessage } from "./wbotMessageListener";

interface Request {
media: Express.Multer.File;
Expand Down Expand Up @@ -185,9 +186,7 @@ const SendWhatsAppMedia = async ({
...options
}
);

await ticket.update({ lastMessage: media.filename });

await verifyMediaMessage(sentMessage, ticket, ticket.contact);
return sentMessage;
} catch (err) {
Sentry.captureException(err);
Expand Down
7 changes: 3 additions & 4 deletions backend/src/services/WbotServices/SendWhatsAppMessage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { WASocket, WAMessage } from "@whiskeysockets/baileys";
import { WAMessage } from "@whiskeysockets/baileys";
import * as Sentry from "@sentry/node";
import AppError from "../../errors/AppError";
import GetTicketWbot from "../../helpers/GetTicketWbot";
import Message from "../../models/Message";
import Ticket from "../../models/Ticket";

import formatBody from "../../helpers/Mustache";
import { verifyMessage } from "./wbotMessageListener";

interface Request {
body: string;
Expand Down Expand Up @@ -59,9 +60,7 @@ const SendWhatsAppMessage = async ({
...options
}
);

await ticket.update({ lastMessage: formattedBody });

await verifyMessage(sentMessage, ticket, ticket.contact);
return sentMessage;
} catch (err) {
Sentry.captureException(err);
Expand Down
2 changes: 1 addition & 1 deletion backend/src/services/WbotServices/wbotMessageListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ const saveMediaToFile = async (media) => {
}
}

const verifyMediaMessage = async (
export const verifyMediaMessage = async (
msg: proto.IWebMessageInfo,
ticket: Ticket,
contact: Contact,
Expand Down

0 comments on commit 90c4d6f

Please sign in to comment.