diff --git a/core/msg_list.js b/core/msg_list.js index 73ab4850..8b91585b 100644 --- a/core/msg_list.js +++ b/core/msg_list.js @@ -60,8 +60,8 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher( this.menuMethods = { selectMessage : (formData, extraArgs, cb) => { if(MciViewIds.allViews.msgList === formData.submitId) { - this.initialFocusIndex = formData.value.messageIndex || - formData.value.message; // older deprecated arg name + // 'messageIndex' or older deprecated 'message' member + this.initialFocusIndex = _.get(formData, 'value.messageIndex', formData.value.message); const modOpts = { extraArgs : { @@ -108,8 +108,9 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher( if(MciViewIds.allViews.msgList != formData.submitId) { return cb(null); } - const messageIndex = formData.value.messageIndex || - formData.value.message; // older, deprecated arg name + + // newer 'messageIndex' or older deprecated value + const messageIndex = _.get(formData, 'value.messageIndex', formData.value.message); return this.promptDeleteMessageConfirm(messageIndex, cb); }, deleteMessageYes : (formData, extraArgs, cb) => { diff --git a/core/oputil/oputil_config.js b/core/oputil/oputil_config.js index 28c065d4..b1490c28 100644 --- a/core/oputil/oputil_config.js +++ b/core/oputil/oputil_config.js @@ -231,11 +231,8 @@ function buildNewConfig() { .replace(/[^a-z0-9_-]/ig, '_') .replace(/_+/g, '_') .toLowerCase(); - const menuFile = `menus/${boardName}-main.hjson`; - const mainTemplate = hjson.rt.parse(fs.readFileSync(paths.join(__dirname, '../../misc/menu_templates/main.in.hjson'), 'utf8')); - - const includeFiles = [ + const includeFilesIn = [ 'message_base.in.hjson', 'private_mail.in.hjson', 'login.in.hjson', @@ -244,8 +241,11 @@ function buildNewConfig() { 'file_base.in.hjson', ]; - includeFiles.forEach(incFile => { + let includeFiles = []; + includeFilesIn.forEach(incFile => { const outName = `${boardName}-${incFile.replace('.in', '')}`; + includeFiles.push(outName); + copyFileSyncSilent( paths.join(__dirname, '../../misc/menu_templates', incFile), paths.join(__dirname, '../../config/menus', outName), @@ -253,21 +253,21 @@ function buildNewConfig() { ); }); - mainTemplate.includes = includeFiles.map(incFile => { - return `${boardName}-${incFile.replace('.in', '')}`; - }); + // We really only need includes to be replaced + const mainTemplate = fs.readFileSync(paths.join(__dirname, '../../misc/menu_templates/main.in.hjson'), 'utf8') + .replace(/%INCLUDE_FILES%/g, includeFiles.join('\n\t\t')); // cheesy, but works! - if (writeConfig( + const menuFile = `${boardName}-main.hjson`; + fs.writeFileSync( + paths.join(__dirname, '../../config/menus', menuFile), mainTemplate, - paths.join(__dirname, '../../config/menus', `${boardName}-main.hjson`))) - { - config.general.menuFile = menuFile; + 'utf8' + ); - if(writeConfig(config, configPath)) { - console.info('Configuration generated'); - } else { - console.error('Failed writing configuration'); - } + config.general.menuFile = paths.join(__dirname, '../../config/menus/', menuFile); + + if(writeConfig(config, configPath)) { + console.info('Configuration generated'); } else { console.error('Failed writing configuration'); } diff --git a/misc/menu_templates/login.in.hjson b/misc/menu_templates/login.in.hjson index d16ace0c..c3fc5340 100644 --- a/misc/menu_templates/login.in.hjson +++ b/misc/menu_templates/login.in.hjson @@ -364,7 +364,7 @@ module: msg_list art: NEWMSGS config: { - menuViewPost: messageBaseViewPost + menuViewPost: messageAreaViewPost } form: { 0: { @@ -379,7 +379,7 @@ submit: { *: [ { - value: { message: null } + value: { messageIndex: null } action: @method:selectMessage } ] diff --git a/misc/menu_templates/main.in.hjson b/misc/menu_templates/main.in.hjson index cacb18ee..f2caef56 100644 --- a/misc/menu_templates/main.in.hjson +++ b/misc/menu_templates/main.in.hjson @@ -51,7 +51,7 @@ // You may include as many additional fragments as you like here. includes: [ - XXXXXXXX + %INCLUDE_FILES% ] // This section creates common fragments to use as @reference diff --git a/misc/menu_templates/message_base.in.hjson b/misc/menu_templates/message_base.in.hjson index e5bfb822..fd4adf97 100644 --- a/misc/menu_templates/message_base.in.hjson +++ b/misc/menu_templates/message_base.in.hjson @@ -381,7 +381,7 @@ submit: { *: [ { - value: { message: null } + value: { messageIndex: null } action: @method:selectMessage } ] @@ -427,7 +427,7 @@ submit: { *: [ { - value: { message: null } + value: { messageIndex: null } action: @method:selectMessage } ] diff --git a/misc/menu_templates/private_mail.in.hjson b/misc/menu_templates/private_mail.in.hjson index 0ebd2fa9..ebf4d104 100644 --- a/misc/menu_templates/private_mail.in.hjson +++ b/misc/menu_templates/private_mail.in.hjson @@ -145,7 +145,7 @@ module: msg_list art: PRVMSGLIST config: { - menuViewPost: messageBaseViewPost + menuViewPost: messageAreaViewPost messageAreaTag: private_mail } form: { @@ -160,7 +160,7 @@ submit: { *: [ { - value: { message: null } + value: { messageIndex: null } action: @method:selectMessage } ]