Skip to content

Commit

Permalink
fix(core.gblib): SSR fixing about botId.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Mar 20, 2023
1 parent 56b6877 commit 799715a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
22 changes: 12 additions & 10 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,16 +773,18 @@ export class GBMinService {
await min.whatsAppDirectLine.setup(true);
} else {
const minBoot = GBServer.globals.minBoot as any;
min.whatsAppDirectLine = new WhatsappDirectLine(
min,
min.botId,
min.instance.whatsappBotKey,
minBoot.instance.whatsappServiceKey,
minBoot.instance.whatsappServiceNumber,
minBoot.instance.whatsappServiceUrl,
group
);
await min.whatsAppDirectLine.setup(false);
if (min !== minBoot) {
min.whatsAppDirectLine = new WhatsappDirectLine(
min,
min.botId,
min.instance.whatsappBotKey,
minBoot.instance.whatsappServiceKey,
minBoot.instance.whatsappServiceNumber,
minBoot.instance.whatsappServiceUrl,
group
);
await min.whatsAppDirectLine.setup(false);
}
}

// Setups default BOT Framework dialogs.
Expand Down
4 changes: 3 additions & 1 deletion packages/core.gbapp/services/GBSSR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ export class GBSSR {
if (!min) {
min = req.url === '/'
? minBoot
: GBServer.globals.minInstances.filter(p => p.instance.activationCode.toLowerCase() === botId.toLowerCase())[0];
: GBServer.globals.minInstances.filter(p =>
p.instance.activationCode ? p.instance.activationCode.toLowerCase() === botId.toLowerCase()
: null)[0];
}
if (!min) {
botId = minBoot.botId;
Expand Down
2 changes: 1 addition & 1 deletion packages/whatsapp.gblib/services/WhatsappDirectLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ export class WhatsappDirectLine extends GBService {
}
}

// Detects if the welcome message is enabled.z
// Detects if the welcome message is enabled.

if (process.env.WHATSAPP_WELCOME_DISABLED !== 'true') {
// Tries to find if user wants to switch bots.
Expand Down

0 comments on commit 799715a

Please sign in to comment.