diff --git a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts index 8e7eec48..e0115c5b 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/FeedbackDialog.ts @@ -39,6 +39,7 @@ import { BotAdapter } from 'botbuilder'; import { WaterfallDialog } from 'botbuilder-dialogs'; import { GBMinInstance, IGBDialog } from 'botlib'; +import { GBMinService } from '../../core.gbapp/services/GBMinService'; import { AnalyticsService } from '../../analytics.gblib/services/AnalyticsService'; import { SecService } from '../../security.gbapp/services/SecService'; import { CSService } from '../services/CSService'; @@ -83,7 +84,7 @@ export class FeedbackDialog extends IGBDialog { const locale = step.context.activity.locale; const sec = new SecService(); - let from = step.context.activity.from.id; + let from = GBMinService.userMobile(step); await min.conversationalService.sendText(min, step, Messages[locale].please_wait_transfering); const agentSystemId = await sec.assignHumanAgent(from, min.instance.instanceId); @@ -122,7 +123,7 @@ export class FeedbackDialog extends IGBDialog { const locale = step.context.activity.locale; const sec = new SecService(); - const userSystemId = step.context.activity.from.id; + const userSystemId = GBMinService.userMobile(step); const user = await min.userProfile.get(step.context, {}); if (user.systemUser.agentMode === 'self') { diff --git a/packages/security.gbapp/services/SecService.ts b/packages/security.gbapp/services/SecService.ts index 14eadd48..6cd02e04 100644 --- a/packages/security.gbapp/services/SecService.ts +++ b/packages/security.gbapp/services/SecService.ts @@ -2,7 +2,7 @@ const Fs = require('fs'); import urlJoin = require('url-join'); import { ConversationReference } from 'botbuilder'; -import { GBService, IGBInstance } from 'botlib'; +import { GBLog, GBService, IGBInstance } from 'botlib'; import { CollectionUtil } from 'pragmatismo-io-framework'; import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from '../models'; @@ -139,7 +139,7 @@ export class SecService extends GBService { } }); - if (agentSystemId === null && user.agentSystemId ) { + if (agentSystemId === null && user.agentSystemId !== undefined ) { const agent = await GuaribasUser.findOne({ where: { userSystemId: user.agentSystemId @@ -201,9 +201,10 @@ export class SecService extends GBService { agentSystemId = item; } }); - + GBLog.info(`Selected agentId: ${agentSystemId}`); await this.updateHumanAgent(userSystemId, instanceId, agentSystemId); - + GBLog.info(`Updated agentId to: ${agentSystemId}`); + return agentSystemId; }