fix(all): Fix user switching on a single chip.

This commit is contained in:
Rodrigo Rodriguez 2023-09-09 13:09:49 -03:00
parent da02804ac9
commit ed964247da

View file

@ -1036,7 +1036,7 @@ export class WhatsappDirectLine extends GBService {
const botNumber = urlMin ? urlMin.core.getParam(urlMin.instance, 'Bot Number', null) : null;
if (botNumber && GBServer.globals.minBoot.botId !== urlMin.botId) {
GBLog.info(`${user.userSystemId} user changed Bot to: ${botId}.`);
GBLog.info(`${user.userSystemId} fixed by bot number talked to: ${botId}.`);
user = await sec.updateUserInstance(user.userSystemId, urlMin.instance.instanceId);
}
@ -1154,7 +1154,7 @@ export class WhatsappDirectLine extends GBService {
// So gets the new bot instance information and prepares to
// auto start dialog if any is specified.
activeMin = toSwitchMin;
const instance = await this.min.core.loadInstanceByBotId(activeMin.botId);
await sec.updateUserInstance(id, instance.instanceId);
await (activeMin as any).whatsAppDirectLine.resetConversationId(activeMin.botId, id, '');