From 4199e034f9c9504b8543ca6d913cce2395bef16f Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Fri, 8 Mar 2019 09:14:16 -0500 Subject: [PATCH] fix(install): crash --- app.js | 35 +------------------------------ src/controllers/api/v1/tickets.js | 3 ++- src/helpers/hbs/helpers.js | 3 ++- 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/app.js b/app.js index 770800ff1..646222cd0 100644 --- a/app.js +++ b/app.js @@ -189,41 +189,8 @@ function launchServer (db) { // return next() // }, function (next) { - // var pm2 = require('pm2'); - // pm2.connect(true, function(err) { - // if (err) throw err; - // pm2.start({ - // script: path.join(__dirname, '/src/cache/index.js'), - // name: 'trudesk:cache', - // output: path.join(__dirname, '/logs/cache.log'), - // error: path.join(__dirname, '/logs/cache.log'), - // env: { - // FORK: 1, - // NODE_ENV: global.env - // } - // }, function(err) { - // pm2.disconnect(); - // if (err) throw err; - // - // process.on('message', function(message) { - // if (message.data.cache) { - // var nodeCache = require('./src/cache/node-cache'); - // global.cache = new nodeCache({ - // data: message.data.cache.data, - // checkperiod: 0 - // }); - // } - // }); - // - // next(); - // }); - // }); - var fork = require('child_process').fork - var memLimit = '2048' - if (process.env.MEMORYLIMIT) { - memLimit = process.env.MEMORYLIMIT - } + var memLimit = nconf.get('memlimit') || '2048' var env = { FORK: 1, NODE_ENV: global.env } if (isDocker) { diff --git a/src/controllers/api/v1/tickets.js b/src/controllers/api/v1/tickets.js index e7306e994..8635f18a8 100644 --- a/src/controllers/api/v1/tickets.js +++ b/src/controllers/api/v1/tickets.js @@ -336,7 +336,8 @@ apiTickets.create = function (req, res) { response.success = true var postData = req.body - if (!_.isObject(postData)) return res.status(400).json({ success: false, error: 'Invalid Post Data' }) + if (!_.isObject(postData) || !postData.subject || !postData.issue) + return res.status(400).json({ success: false, error: 'Invalid Post Data' }) var socketId = _.isUndefined(postData.socketId) ? '' : postData.socketId diff --git a/src/helpers/hbs/helpers.js b/src/helpers/hbs/helpers.js index 5d10ca7e1..7d7cecfd9 100644 --- a/src/helpers/hbs/helpers.js +++ b/src/helpers/hbs/helpers.js @@ -618,7 +618,8 @@ var helpers = { }, isNotTrue: function (obj, options) { - if (obj === true || obj.toLowerCase() === 'true') return options.inverse(this) + if (obj === true || (typeof obj.toLowerCase === 'function' && obj.toLowerCase() === 'true')) + return options.inverse(this) return options.fn(this) },