Skip to content

Commit

Permalink
[FIX] Onhold auto chat resume feature not working for email channel (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
murtaza98 authored Jul 28, 2022
1 parent ae4de95 commit 7794a0b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meteor } from 'meteor/meteor';
import { callbacks } from '../../../../../lib/callbacks';
import { LivechatRooms } from '../../../../../app/models/server';

const handleAfterSaveMessage = (message, { _id: rid }) => {
const handleAfterSaveMessage = (message, { _id: rid, t: roomType, v: roomVisitor }) => {
// skips this callback if the message was edited
if (message.editedAt) {
return message;
Expand All @@ -14,14 +14,14 @@ const handleAfterSaveMessage = (message, { _id: rid }) => {
return message;
}

// Need to read the room every time, the room object is not updated
const room = LivechatRooms.findOneById(rid, { t: 1, v: 1, onHold: 1 });
if (!room) {
// message valid only if it is a livechat room
if (!(typeof roomType !== 'undefined' && roomType === 'l' && roomVisitor && roomVisitor.token)) {
return message;
}

// message valid only if it is a livechat room
if (!(typeof room.t !== 'undefined' && room.t === 'l' && room.v && room.v.token)) {
// Need to read the room every time, the room object is not updated
const room = LivechatRooms.findOneById(rid, { t: 1, v: 1, onHold: 1 });
if (!room) {
return message;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/server/email/IMAPInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class IMAPInterceptor extends EventEmitter {
});

this.imap.on('error', (err: Error) => {
this.log('Error occurred ...');
this.log('Error occurred ...', err);
throw err;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export async function onEmailReceived(email: ParsedMail, inbox: string, departme
_id: msgId,
groupable: false,
msg,
token: guest.token,
attachments: [
{
actions: [
Expand Down

0 comments on commit 7794a0b

Please sign in to comment.