fix(basic.gblib): Fix BASIC options set by SET instructions.
This commit is contained in:
parent
53a5d8d692
commit
80697cf944
2 changed files with 18 additions and 10 deletions
|
@ -57,8 +57,11 @@ export class DialogKeywords {
|
||||||
* Reference to the base system keywords functions to be called.
|
* Reference to the base system keywords functions to be called.
|
||||||
*/
|
*/
|
||||||
public internalSys: SystemKeywords;
|
public internalSys: SystemKeywords;
|
||||||
|
|
||||||
private user;
|
/**
|
||||||
|
* Current user object to get BASIC properties read.
|
||||||
|
*/
|
||||||
|
public user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When creating this keyword facade, a bot instance is
|
* When creating this keyword facade, a bot instance is
|
||||||
|
@ -66,8 +69,8 @@ export class DialogKeywords {
|
||||||
*/
|
*/
|
||||||
constructor(min: GBMinInstance, deployer: GBDeployer, step: GBDialogStep, user) {
|
constructor(min: GBMinInstance, deployer: GBDeployer, step: GBDialogStep, user) {
|
||||||
this.min = min;
|
this.min = min;
|
||||||
this.internalSys = new SystemKeywords(min, deployer, user);
|
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
this.internalSys = new SystemKeywords(min, deployer, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,6 +166,7 @@ export class DialogKeywords {
|
||||||
user.systemUser = await sec.updateUserLocale(user.systemUser.userId, language);
|
user.systemUser = await sec.updateUserLocale(user.systemUser.userId, language);
|
||||||
|
|
||||||
await this.min.userProfile.set(step.context, user);
|
await this.min.userProfile.set(step.context, user);
|
||||||
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,8 +179,9 @@ export class DialogKeywords {
|
||||||
const user = await this.min.userProfile.get(step.context, {});
|
const user = await this.min.userProfile.get(step.context, {});
|
||||||
user.basicOptions.maxLines = count;
|
user.basicOptions.maxLines = count;
|
||||||
await this.min.userProfile.set(step.context, user);
|
await this.min.userProfile.set(step.context, user);
|
||||||
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines translator behaviour.
|
* Defines translator behaviour.
|
||||||
*
|
*
|
||||||
|
@ -187,6 +192,7 @@ export class DialogKeywords {
|
||||||
const user = await this.min.userProfile.get(step.context, {});
|
const user = await this.min.userProfile.get(step.context, {});
|
||||||
user.basicOptions.translatorOn = (on.trim() === "on");
|
user.basicOptions.translatorOn = (on.trim() === "on");
|
||||||
await this.min.userProfile.set(step.context, user);
|
await this.min.userProfile.set(step.context, user);
|
||||||
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,6 +37,7 @@ import urlJoin = require('url-join');
|
||||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService';
|
||||||
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
|
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
|
||||||
import { SecService } from '../../security.gbapp/services/SecService';
|
import { SecService } from '../../security.gbapp/services/SecService';
|
||||||
|
import { DialogKeywords } from './DialogKeywords';
|
||||||
const request = require('request-promise-native');
|
const request = require('request-promise-native');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const sgMail = require('@sendgrid/mail');
|
const sgMail = require('@sendgrid/mail');
|
||||||
|
@ -59,17 +60,18 @@ export class SystemKeywords {
|
||||||
* Reference to the deployer service.
|
* Reference to the deployer service.
|
||||||
*/
|
*/
|
||||||
private readonly deployer: GBDeployer;
|
private readonly deployer: GBDeployer;
|
||||||
|
|
||||||
|
dk: DialogKeywords;
|
||||||
|
|
||||||
private user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When creating this keyword facade, a bot instance is
|
* When creating this keyword facade, a bot instance is
|
||||||
* specified among the deployer service.
|
* specified among the deployer service.
|
||||||
*/
|
*/
|
||||||
constructor(min: GBMinInstance, deployer: GBDeployer, user) {
|
constructor(min: GBMinInstance, deployer: GBDeployer, dk: DialogKeywords) {
|
||||||
this.user = user;
|
|
||||||
this.min = min;
|
this.min = min;
|
||||||
this.deployer = deployer;
|
this.deployer = deployer;
|
||||||
|
this.dk = dk;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -290,9 +292,9 @@ export class SystemKeywords {
|
||||||
|
|
||||||
|
|
||||||
let maxLines = 100;
|
let maxLines = 100;
|
||||||
if (this.user.basicOptions && this.user.basicOptions.maxLines) {
|
if (this.dk.user.basicOptions && this.dk.user.basicOptions.maxLines) {
|
||||||
if (this.user.basicOptions.maxLines.toString().toLowerCase() !== "default") {
|
if (this.dk.user.basicOptions.maxLines.toString().toLowerCase() !== "default") {
|
||||||
maxLines = Number.parseInt(this.user.basicOptions.maxLines).valueOf();
|
maxLines = Number.parseInt(this.dk.user.basicOptions.maxLines).valueOf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue