Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Onhold auto chat resume feature not working for email channel #26363

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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