Merge branch 'master' of github.com:NodeBB/NodeBB

v1.18.x
Julian Lam 11 years ago
commit de0da80040

4
.gitignore vendored

@ -17,9 +17,7 @@ provision.sh
.DS_Store .DS_Store
feeds/recent.rss feeds/recent.rss
# winston? logs/
error.log
events.log
pidfile pidfile

@ -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 # 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. 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.

@ -72,7 +72,7 @@ $(document).ready(function() {
if (ajaxify.isTemplateAvailable(tpl_url) && !!!templatesModule.config.force_refresh[tpl_url]) { if (ajaxify.isTemplateAvailable(tpl_url) && !!!templatesModule.config.force_refresh[tpl_url]) {
ajaxify.currentPage = url; ajaxify.currentPage = url;
if (window.history && window.history.pushState) { if (window.history && window.history.pushState && url !== '404') {
window.history[!quiet ? 'pushState' : 'replaceState']({ window.history[!quiet ? 'pushState' : 'replaceState']({
url: url + hash url: url + hash
}, url, RELATIVE_PATH + '/' + url + hash); }, url, RELATIVE_PATH + '/' + url + hash);

@ -152,7 +152,7 @@ define('navigator', ['forum/pagination'], function(pagination) {
} }
navigator.scrollToPost = function(postIndex, highlight, duration, offset) { navigator.scrollToPost = function(postIndex, highlight, duration, offset) {
if (!utils.isNumber(postIndex)) { if (!utils.isNumber(postIndex) || !$('.post-container').length) {
return; return;
} }

@ -544,7 +544,8 @@ accountsController.getChats = function(req, res, next) {
return res.render('chats', { return res.render('chats', {
chats: results.recentChats.users, chats: results.recentChats.users,
nextStart: results.recentChats.nextStart, nextStart: results.recentChats.nextStart,
contacts: results.contacts contacts: results.contacts,
allowed: true
}); });
} }

@ -44,18 +44,6 @@ topicsController.get = function(req, res, next) {
}, },
function (results, 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; userPrivileges = results.privileges;
if (userPrivileges.disabled) { if (userPrivileges.disabled) {
@ -70,6 +58,18 @@ topicsController.get = function(req, res, next) {
return categoriesController.notAllowed(req, res); 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 settings = results.settings;
var set = 'tid:' + tid + ':posts', var set = 'tid:' + tid + ':posts',
reverse = false; reverse = false;

@ -51,7 +51,7 @@
} }
} catch (err) { } catch (err) {
winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message); winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message);
process.exit(); return callback(err);
} }
var usernamePassword = ''; var usernamePassword = '';
@ -66,9 +66,9 @@
} }
}; };
mongoClient.connect(connString, connOptions, function(err, _db) { 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); winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + err.message);
process.exit(); return callback(err);
} }
db = _db; db = _db;

@ -25,8 +25,10 @@ var async = require('async'),
return callback(new Error('[[error:cant-vote-self-post]]')); return callback(new Error('[[error:cant-vote-self-post]]'));
} }
var now = Date.now();
if(type === 'upvote' && !unvote) { if(type === 'upvote' && !unvote) {
db.sortedSetAdd('uid:' + uid + ':upvote', postData.timestamp, pid); db.sortedSetAdd('uid:' + uid + ':upvote', now, pid);
} else { } else {
db.sortedSetRemove('uid:' + uid + ':upvote', pid); db.sortedSetRemove('uid:' + uid + ':upvote', pid);
} }
@ -34,7 +36,7 @@ var async = require('async'),
if(type === 'upvote' || unvote) { if(type === 'upvote' || unvote) {
db.sortedSetRemove('uid:' + uid + ':downvote', pid); db.sortedSetRemove('uid:' + uid + ':downvote', pid);
} else { } 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) { user[type === 'upvote' ? 'incrementUserFieldBy' : 'decrementUserFieldBy'](postData.uid, 'reputation', 1, function (err, newreputation) {

Loading…
Cancel
Save