Skip to content

Commit

Permalink
fix(security.gbalib): Transfer issues fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Dec 8, 2021
1 parent 6ebd38d commit fefcbb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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') {
Expand Down
9 changes: 5 additions & 4 deletions packages/security.gbapp/services/SecService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit fefcbb0

Please sign in to comment.