fix(core.gbapp): Images now working in WhatsApp.

This commit is contained in:
Rodrigo Rodriguez 2021-08-19 09:14:18 -03:00
parent f9ab5b3437
commit 525f465be4

View file

@ -216,8 +216,7 @@ export class GBConversationalService {
} }
public userMobile(step) { public userMobile(step) {
if (!step) if (!step) {
{
return 'N/A'; return 'N/A';
} }
if (isNaN(step.context.activity['mobile'])) { if (isNaN(step.context.activity['mobile'])) {
@ -427,12 +426,13 @@ export class GBConversationalService {
text = text.replace(`](kb`, "](" + process.env.BOT_URL + '/kb'); // TODO: Improve it. text = text.replace(`](kb`, "](" + process.env.BOT_URL + '/kb'); // TODO: Improve it.
// According to the channel, formats the output optimized to it. // According to the channel, formats the output optimized to it.
const mobile = this.userMobile(step);
if (channel === 'webchat' && GBConfigService.get('DISABLE_WEB') !== 'true') { if (mobile) {
await this.sendMarkdownToMobile(min, step, user.systemUser.userSystemId, text);
} else if (GBConfigService.get('DISABLE_WEB') !== 'true') {
const html = marked(text); const html = marked(text);
await this.sendMarkdownToWeb(min, step, html, answer); await this.sendMarkdownToWeb(min, step, html, answer);
} else if (channel === 'whatsapp') {
await this.sendMarkdownToMobile(min, step, user.userSystemId, text);
} else { } else {
const html = marked(text); const html = marked(text);
await min.conversationalService.sendText(min, step, html); await min.conversationalService.sendText(min, step, html);