Compare commits

..

No commits in common. "b9f8bfc8d50fa65c9d163ce8c288be076bee3d63" and "e1e10d8226d82674cba4a822e55cf3f928424964" have entirely different histories.

6 changed files with 23 additions and 42 deletions

View File

@ -885,15 +885,11 @@ async function handleMessage(msg) {
if (msg.fromMe) { if (msg.fromMe) {
console.log('MSG FROM ME')
msgContact = await client.getContactById(msg.to) msgContact = await client.getContactById(msg.to)
} }
else { else {
console.log('MSG FROM CLIENT')
console.log('################# RECEIVING MESSAGE FROM: ', msg.from, ' to ', msg.to) console.log('################# RECEIVING MESSAGE FROM: ', msg.from, ' to ', msg.to)
msgContact = await msg.getContact() msgContact = await msg.getContact()
@ -916,10 +912,10 @@ async function handleMessage(msg) {
msgContact: msgContact, msgContact: msgContact,
chat: chat, chat: chat,
quotedMsg: quotedMsg ? quotedMsg.id.id : null, quotedMsg: quotedMsg ? quotedMsg.id.id : null,
media: media, media: media
getContactById: msg.fromMe ? await client.getContactById(msg.to) : await client.getContactById(msg.from)
} }
socketIo.emit("message_create", data) socketIo.emit("message_create", data)
} }

View File

@ -64,7 +64,6 @@ const FindOrCreateTicketService = async (
await ticket.update({ await ticket.update({
status: "pending", status: "pending",
userId: null, userId: null,
queueId: null,
unreadMessages unreadMessages
}); });
} }
@ -97,12 +96,7 @@ const FindOrCreateTicketService = async (
if (!ticket) { if (!ticket) {
let status = "pending"; let status = "pending";
if ( if (queues.length > 1 && !botInfo.isOnQueue && !queueId) {
queues.length > 1 &&
!botInfo.isOnQueue &&
!queueId &&
!groupContact
) {
status = "queueChoice"; status = "queueChoice";
} }

View File

@ -372,12 +372,6 @@ const verifyQueue = async (
ticket: Ticket, ticket: Ticket,
contact: Contact contact: Contact
) => { ) => {
if(ticket?.isGroup){
return
}
const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!); const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!);
let selectedOption = null; let selectedOption = null;
@ -709,7 +703,7 @@ const handleMessage = async (
try { try {
let msgContact: any = wbot.msgContact; let msgContact: any = wbot.msgContact;
let groupContact: Contact | undefined; // let groupContact: Contact | undefined;
if (msg.fromMe) { if (msg.fromMe) {
// messages sent automatically by wbot have a special character in front of it // messages sent automatically by wbot have a special character in front of it
@ -749,20 +743,17 @@ const handleMessage = async (
// console.log('----------> chat: ', JSON.parse(JSON.stringify(chat))) // console.log('----------> chat: ', JSON.parse(JSON.stringify(chat)))
// if (chat.isGroup) {
// let msgGroupContact;
console // if (msg.fromMe) {
// msgGroupContact = await wbot.getContactById(msg.to);
// } else {
// msgGroupContact = await wbot.getContactById(msg.from);
// }
if (chat.isGroup) { // groupContact = await verifyContact(msgGroupContact);
// let msgGroupContact; // }
// if (msg.fromMe) {
// msgGroupContact = await wbot.getContactById(msg.to);
// } else {
// msgGroupContact = await wbot.getContactById(msg.from);
// }
groupContact = await verifyContact(wbot.getContactById);
}
const whatsapp = await ShowWhatsAppService(wbot.id!); const whatsapp = await ShowWhatsAppService(wbot.id!);
@ -786,12 +777,12 @@ const handleMessage = async (
const _botInfo = await BotIsOnQueue("botqueue"); const _botInfo = await BotIsOnQueue("botqueue");
if (_botInfo.isOnQueue && !chat.isGroup) { if (_botInfo.isOnQueue) {
let ticket_obj: any = await FindOrCreateTicketServiceBot( let ticket_obj: any = await FindOrCreateTicketServiceBot(
contact, contact,
wbot.id!, wbot.id!,
unreadMessages, unreadMessages
groupContact // groupContact
); );
ticket = ticket_obj.ticket; ticket = ticket_obj.ticket;
@ -810,8 +801,8 @@ const handleMessage = async (
ticket = await FindOrCreateTicketService( ticket = await FindOrCreateTicketService(
contact, contact,
wbot.id!, wbot.id!,
unreadMessages, unreadMessages
groupContact // groupContact
); );
} }

View File

@ -387,10 +387,10 @@ const NotificationsPopOver = () => {
vertical: "top", vertical: "top",
horizontal: "right", horizontal: "right",
}} }}
classes={{ paper: classes?.popoverPaper }} classes={{ paper: classes.popoverPaper }}
onClose={handleClickAway} onClose={handleClickAway}
> >
<List dense className={classes?.tabContainer}> <List dense className={classes.tabContainer}>
{notifications.length === 0 ? ( {notifications.length === 0 ? (
<ListItem> <ListItem>
<ListItemText>{i18n.t("notifications.noTickets")}</ListItemText> <ListItemText>{i18n.t("notifications.noTickets")}</ListItemText>

View File

@ -229,7 +229,7 @@ const TicketListItem = ({ ticket, remoteTicketsControll, settings }) => {
variant="body2" variant="body2"
color="textPrimary" color="textPrimary"
> >
{ticket?.contact?.name} {ticket.contact.name}
</Typography> </Typography>
{ticket.status === "closed" && ( {ticket.status === "closed" && (
<Badge <Badge