fix(core.gbapp): Keep text fixed.
This commit is contained in:
parent
7f48c475f6
commit
50564c64d2
3 changed files with 36 additions and 16 deletions
|
@ -108,7 +108,7 @@ export class GBAdminService implements IGBAdminService {
|
|||
lowerCaseAlpha: true,
|
||||
number: true,
|
||||
specialCharacter: true,
|
||||
minimumLength: 12,
|
||||
minimumLength: 14,
|
||||
maximumLength: 14
|
||||
};
|
||||
let password = passwordGenerator.generatePassword(options);
|
||||
|
@ -124,7 +124,21 @@ export class GBAdminService implements IGBAdminService {
|
|||
lowerCaseAlpha: true,
|
||||
number: false,
|
||||
specialCharacter: false,
|
||||
minimumLength: 12,
|
||||
minimumLength: 14,
|
||||
maximumLength: 14
|
||||
};
|
||||
|
||||
return passwordGenerator.generatePassword(options);
|
||||
}
|
||||
|
||||
public static getNumberIdentifier() {
|
||||
const passwordGenerator = new PasswordGenerator();
|
||||
const options = {
|
||||
upperCaseAlpha: false,
|
||||
lowerCaseAlpha: false,
|
||||
number: true,
|
||||
specialCharacter: false,
|
||||
minimumLength: 14,
|
||||
maximumLength: 14
|
||||
};
|
||||
|
||||
|
@ -226,7 +240,7 @@ export class GBAdminService implements IGBAdminService {
|
|||
return path.indexOf('sharepoint.com') > 0;
|
||||
}
|
||||
|
||||
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> {}
|
||||
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> { }
|
||||
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: IGBDeployer) {
|
||||
const packageName = text.split(' ')[1];
|
||||
|
||||
|
|
|
@ -640,10 +640,15 @@ export class GBConversationalService {
|
|||
}
|
||||
|
||||
public async sendText(min: GBMinInstance, step, text) {
|
||||
await this['sendTextWithOptions'](min, step, text, true);
|
||||
}
|
||||
|
||||
public async sendTextWithOptions(min: GBMinInstance, step, text, translate) {
|
||||
const member = step.context.activity.from;
|
||||
const user = await min.userProfile.get(step.context, {});
|
||||
const systemUser = user.systemUser;
|
||||
|
||||
if (translate) {
|
||||
text = await min.conversationalService.translate(
|
||||
min,
|
||||
text,
|
||||
|
@ -652,9 +657,9 @@ export class GBConversationalService {
|
|||
: min.core.getParam<string>(min.instance, 'Locale', GBConfigService.get('LOCALE'))
|
||||
);
|
||||
GBLog.info(`Translated text(sendText): ${text}.`);
|
||||
}
|
||||
|
||||
const analytics = new AnalyticsService();
|
||||
|
||||
analytics.createMessage(min.instance.instanceId, user.conversation, null, text);
|
||||
|
||||
if (!isNaN(member.id)) {
|
||||
|
|
|
@ -77,6 +77,7 @@ import { WhatsappDirectLine } from '../../whatsapp.gblib/services/WhatsappDirect
|
|||
import fs = require('fs');
|
||||
import { GuaribasConversationMessage } from '../../analytics.gblib/models';
|
||||
import { GBVMService } from './GBVMService';
|
||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
||||
|
||||
/**
|
||||
* Minimal service layer for a bot.
|
||||
|
@ -802,7 +803,7 @@ export class GBMinService {
|
|||
);
|
||||
|
||||
let keepTextList = [];
|
||||
|
||||
const replacementToken = GBAdminService['getNumberIdentifier']();
|
||||
if (keepTextList) {
|
||||
keepTextList = keepTextList.concat(keepText.split(';'));
|
||||
}
|
||||
|
@ -818,7 +819,7 @@ export class GBMinService {
|
|||
let i = 0;
|
||||
await CollectionUtil.asyncForEach(keepTextList, item => {
|
||||
i++;
|
||||
text = text.replace(new RegExp(item.trim(), 'gi'), `KEEPTEXT${i}`);
|
||||
text = text.replace(new RegExp(item.trim(), 'gi'), `${replacementToken}${i}`);
|
||||
});
|
||||
}
|
||||
text = await min.conversationalService.spellCheck(min, text);
|
||||
|
@ -868,7 +869,7 @@ export class GBMinService {
|
|||
let i = 0;
|
||||
await CollectionUtil.asyncForEach(keepTextList, item => {
|
||||
i++;
|
||||
text = text.replace(new RegExp(`\\bKEEPTEXT${i}\\b`, 'gi'), item.trim());
|
||||
text = text.replace(new RegExp(`\\b${replacementToken}${i}\\b`, 'gi'), item.trim());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue