From e93398b647d4ee86becec20849dafd480db54b5e Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 30 Oct 2014 19:37:17 -0400 Subject: [PATCH 1/7] use currentTime when someone up/down votes --- src/favourites.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/favourites.js b/src/favourites.js index 341766bdb3..123e014bc9 100644 --- a/src/favourites.js +++ b/src/favourites.js @@ -25,8 +25,10 @@ var async = require('async'), return callback(new Error('[[error:cant-vote-self-post]]')); } + var now = Date.now(); + if(type === 'upvote' && !unvote) { - db.sortedSetAdd('uid:' + uid + ':upvote', postData.timestamp, pid); + db.sortedSetAdd('uid:' + uid + ':upvote', now, pid); } else { db.sortedSetRemove('uid:' + uid + ':upvote', pid); } @@ -34,7 +36,7 @@ var async = require('async'), if(type === 'upvote' || unvote) { db.sortedSetRemove('uid:' + uid + ':downvote', pid); } else { - db.sortedSetAdd('uid:' + uid + ':downvote', postData.timestamp, pid); + db.sortedSetAdd('uid:' + uid + ':downvote', now, pid); } user[type === 'upvote' ? 'incrementUserFieldBy' : 'decrementUserFieldBy'](postData.uid, 'reputation', 1, function (err, newreputation) { From 0bb04249988866e3f0ab81df749b8bc79aa1f2fe Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 30 Oct 2014 22:19:11 -0400 Subject: [PATCH 2/7] bubble error --- src/database/mongo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/database/mongo.js b/src/database/mongo.js index 0a5c5db6ef..3356f01cde 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -51,7 +51,7 @@ } } catch (err) { winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message); - process.exit(); + return callback(err); } var usernamePassword = ''; @@ -66,9 +66,9 @@ } }; mongoClient.connect(connString, connOptions, function(err, _db) { - if(err) { + if (err) { winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + err.message); - process.exit(); + return callback(err); } db = _db; From 0ede4abe18f14bc18246deb3a547045af133bfce Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 30 Oct 2014 22:47:15 -0400 Subject: [PATCH 3/7] possible fix for #1848 --- public/src/ajaxify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 184920b3f8..2aa61c9426 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -72,7 +72,7 @@ $(document).ready(function() { if (ajaxify.isTemplateAvailable(tpl_url) && !!!templatesModule.config.force_refresh[tpl_url]) { ajaxify.currentPage = url; - if (window.history && window.history.pushState) { + if (window.history && window.history.pushState && url !== '404') { window.history[!quiet ? 'pushState' : 'replaceState']({ url: url + hash }, url, RELATIVE_PATH + '/' + url + hash); From e97bfc139bab1465967dbee0cb47158c089566c2 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 30 Oct 2014 23:14:33 -0400 Subject: [PATCH 4/7] #1848 --- public/src/modules/navigator.js | 2 +- src/controllers/topics.js | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index 5528b78b51..cfccbb871d 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -152,7 +152,7 @@ define('navigator', ['forum/pagination'], function(pagination) { } navigator.scrollToPost = function(postIndex, highlight, duration, offset) { - if (!utils.isNumber(postIndex)) { + if (!utils.isNumber(postIndex) || !$('.post-container').length) { return; } diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 7be21fd793..c816f29ecb 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -44,18 +44,6 @@ topicsController.get = function(req, res, next) { }, function (results, next) { - var postCount = parseInt(results.postCount, 10); - if (utils.isNumber(req.params.post_index)) { - var url = ''; - if (req.params.post_index > postCount) { - url = '/topic/' + req.params.topic_id + '/' + req.params.slug + '/' + postCount; - return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url); - } else if (req.params.post_index < 1) { - url = '/topic/' + req.params.topic_id + '/' + req.params.slug; - return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url); - } - } - userPrivileges = results.privileges; if (userPrivileges.disabled) { @@ -70,6 +58,18 @@ topicsController.get = function(req, res, next) { return categoriesController.notAllowed(req, res); } + var postCount = parseInt(results.postCount, 10); + if (utils.isNumber(req.params.post_index)) { + var url = ''; + if (req.params.post_index > postCount) { + url = '/topic/' + req.params.topic_id + '/' + req.params.slug + '/' + postCount; + return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url); + } else if (req.params.post_index < 1) { + url = '/topic/' + req.params.topic_id + '/' + req.params.slug; + return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url); + } + } + var settings = results.settings; var set = 'tid:' + tid + ':posts', reverse = false; From de8c1ece1476034c82395aad921eb7181d5de8f7 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 31 Oct 2014 00:48:24 -0400 Subject: [PATCH 5/7] adding to contributing.md --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e75645e92b..111cd41c46 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,8 @@ +# Having problems installing NodeBB? + +Chances are somebody has run into this problem before. After consulting our [documentation](https://docs.nodebb.org/en/latest/installing/os.html), please head over to our [community support forum](https://community.nodebb.org) for advice. + + # Issues & Bugs Thanks for reporting an issue with NodeBB! Please follow these guidelines in order to streamline the debugging process. The more guidelines you follow, the easier it will be for us to reproduce your problem. From fb1095fc2869983be68b24c045dafdbe1b1f2fac Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 31 Oct 2014 01:50:20 -0400 Subject: [PATCH 6/7] added allowed true to /chats --- src/controllers/accounts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/accounts.js b/src/controllers/accounts.js index 735aedb55c..35e86d7f81 100644 --- a/src/controllers/accounts.js +++ b/src/controllers/accounts.js @@ -544,7 +544,8 @@ accountsController.getChats = function(req, res, next) { return res.render('chats', { chats: results.recentChats.users, nextStart: results.recentChats.nextStart, - contacts: results.contacts + contacts: results.contacts, + allowed: true }); } From 0a1b31e6bc86242f1a0d89aa737b34ca001d6ece Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 31 Oct 2014 01:56:39 -0400 Subject: [PATCH 7/7] small change to gitignore re: logs --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9cc6516546..2f966c4535 100644 --- a/.gitignore +++ b/.gitignore @@ -17,9 +17,7 @@ provision.sh .DS_Store feeds/recent.rss -# winston? -error.log -events.log +logs/ pidfile