[FIX] Support ID param on createVisitor method (#22772)

* FIX createVisitor not supporting id param

* Fix build

* Apply suggestions for code review

Co-authored-by: Kevin Aleman <kevin.aleman@rocket.chat>
pull/22751/head^2
Murtaza Patrawala 4 years ago committed by GitHub
parent 32f5b8d2fb
commit 297b4e0c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/apps/server/bridges/livechat.ts
  2. 4
      app/livechat/server/lib/Livechat.js
  3. 1
      server/features/EmailInbox/EmailInbox_Incoming.ts

@ -127,6 +127,7 @@ export class AppLivechatBridge extends LivechatBridge {
email: '',
connectionData: undefined,
phone: {},
id: visitor.id,
};
if (visitor.visitorEmails && visitor.visitorEmails.length) {

@ -221,8 +221,9 @@ export const Livechat = {
return true;
},
registerGuest({ token, name, email, department, phone, username, connectionData } = {}) {
registerGuest({ id, token, name, email, department, phone, username, connectionData } = {}) {
check(token, String);
check(id, Match.Maybe(String));
let userId;
const updateUser = {
@ -264,6 +265,7 @@ export const Livechat = {
const userData = {
username,
ts: new Date(),
...id && { _id: id },
};
if (settings.get('Livechat_Allow_collect_and_store_HTTP_header_informations')) {

@ -43,6 +43,7 @@ function getGuestByEmail(email: string, name: string, department?: string): any
phone: undefined,
username: undefined,
connectionData: undefined,
id: undefined,
});
const newGuest = LivechatVisitors.findOneById(userId, {});

Loading…
Cancel
Save