Cleanup code for new getConditionalValue() support
This commit is contained in:
parent
ceab8a0180
commit
1870db7d38
|
@ -52,18 +52,13 @@ module.exports = class MenuStack {
|
||||||
const currentModuleInfo = this.top();
|
const currentModuleInfo = this.top();
|
||||||
assert(currentModuleInfo, 'Empty menu stack!');
|
assert(currentModuleInfo, 'Empty menu stack!');
|
||||||
|
|
||||||
const menuConfig = currentModuleInfo.instance.menuConfig;
|
const menuConfig = currentModuleInfo.instance.menuConfig;
|
||||||
let nextMenu;
|
const nextMenu = this.client.acs.getConditionalValue(menuConfig.next, 'next');
|
||||||
|
if(!nextMenu) {
|
||||||
if(_.isArray(menuConfig.next)) {
|
return cb(Array.isArray(menuConfig.next) ?
|
||||||
nextMenu = this.client.acs.getConditionalValue(menuConfig.next, 'next');
|
Errors.MenuStack('No matching condition for "next"', 'NOCONDMATCH') :
|
||||||
if(!nextMenu) {
|
Errors.MenuStack('Invalid or missing "next" member in menu config', 'BADNEXT')
|
||||||
return cb(Errors.MenuStack('No matching condition for "next"', 'NOCONDMATCH'));
|
);
|
||||||
}
|
|
||||||
} else if(_.isString(menuConfig.next)) {
|
|
||||||
nextMenu = menuConfig.next;
|
|
||||||
} else {
|
|
||||||
return cb(Errors.MenuStack('Invalid or missing "next" member in menu config', 'BADNEXT'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nextMenu === currentModuleInfo.name) {
|
if(nextMenu === currentModuleInfo.name) {
|
||||||
|
|
Loading…
Reference in New Issue