fix(security.gbalib): Transfer issues fixed.

This commit is contained in:
Rodrigo Rodriguez 2021-12-08 16:03:29 -03:00
parent 6ebd38d3eb
commit fefcbb04bf
2 changed files with 8 additions and 6 deletions

View file

@ -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') {

View file

@ -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;
}