From 0202666ed0f540ef6a37ebbefdbe5f832c8ae40b Mon Sep 17 00:00:00 2001 From: psychobunny Date: Mon, 24 Nov 2014 20:09:23 -0500 Subject: [PATCH 1/2] taking a break with an almost completely pointless commit --- app.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index f344cd4b30..af9683eb3f 100644 --- a/app.js +++ b/app.js @@ -108,17 +108,17 @@ function start() { loadConfig(); if (!cluster.isWorker || process.env.cluster_setup === 'true') { - winston.info('Time: ' + new Date()); - winston.info('Initializing NodeBB v' + pkg.version); - winston.info('* using configuration stored in: ' + configFile); + winston.info('Time: %s', (new Date()).toString()); + winston.info('Initializing NodeBB v%s', pkg.version); + winston.info('* using configuration stored in: %s', configFile); } if (cluster.isWorker && process.env.cluster_setup === 'true') { var host = nconf.get(nconf.get('database') + ':host'), storeLocation = host ? 'at ' + host + (host.indexOf('/') === -1 ? ':' + nconf.get(nconf.get('database') + ':port') : '') : ''; - winston.info('* using ' + nconf.get('database') +' store ' + storeLocation); - winston.info('* using themes stored in: ' + nconf.get('themes_path')); + winston.info('* using %s store %s', nconf.get('database'), storeLocation); + winston.info('* using themes stored in: %s', nconf.get('themes_path')); } require('./src/database').init(function(err) { @@ -170,12 +170,12 @@ function start() { case 'js-propagate': meta.js.cache = message.cache; meta.js.map = message.map; - winston.info('[cluster] Client-side javascript and mapping propagated to worker ' + cluster.worker.id); + winston.info('[cluster] Client-side javascript and mapping propagated to worker %s', cluster.worker.id); break; case 'css-propagate': meta.css.cache = message.cache; meta.css.acpCache = message.acpCache; - winston.info('[cluster] Stylesheets propagated to worker ' + cluster.worker.id); + winston.info('[cluster] Stylesheets propagated to worker %s', cluster.worker.id); break; } }); @@ -265,7 +265,7 @@ function reset() { if (!err) { winston.info('[reset] Reset complete.'); } else { - winston.error('[reset] Errors were encountered while resetting your forum settings: ' + err.message); + winston.error('[reset] Errors were encountered while resetting your forum settings: %s', err.message); } process.exit(); }); @@ -311,14 +311,14 @@ function resetPlugin(pluginId) { var db = require('./src/database'); db.setRemove('plugins:active', pluginId, function(err, result) { if (err || result !== 1) { - winston.error('[reset] Could not disable plugin: ' + pluginId); + winston.error('[reset] Could not disable plugin: %s', pluginId); if (err) { - winston.error('[reset] Encountered error: ' + err.message); + winston.error('[reset] Encountered error: %s', err.message); } else { winston.info('[reset] Perhaps it has already been disabled?'); } } else { - winston.info('[reset] Plugin `' + pluginId + '` disabled'); + winston.info('[reset] Plugin `%s` disabled', pluginId); } process.exit(); From a69eafd9f7aa425765b05f1dd77a111747155cab Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 24 Nov 2014 21:45:13 -0500 Subject: [PATCH 2/2] added postcount to topic --- src/categories.js | 4 +++- src/posts/summary.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/categories.js b/src/categories.js index 7263d068c6..eb65878864 100644 --- a/src/categories.js +++ b/src/categories.js @@ -171,7 +171,9 @@ var async = require('async'), category.name = validator.escape(category.name); category.disabled = parseInt(category.disabled, 10) === 1; category.icon = category.icon || 'hidden'; - category.post_count = category.post_count || 0; + if (category.hasOwnProperty('post_count')) { + category.post_count = category.post_count || 0; + } if (category.description) { category.description = validator.escape(category.description); diff --git a/src/posts/summary.js b/src/posts/summary.js index 463298f0c3..dd537ce8d6 100644 --- a/src/posts/summary.js +++ b/src/posts/summary.js @@ -105,7 +105,7 @@ module.exports = function(Posts) { }; function getTopicAndCategories(topicKeys, callback) { - db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted'], function(err, topics) { + db.getObjectsFields(topicKeys, ['uid', 'tid', 'title', 'cid', 'slug', 'deleted', 'postcount'], function(err, topics) { if (err) { return callback(err); }