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
feeds/recent.rss
# winston?
error.log
events.log
logs/
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
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]) {
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);

@ -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;
}

@ -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
});
}

@ -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;

@ -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;

@ -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) {

Loading…
Cancel
Save