makes recent unread and category pages a lot faster, added logging when a user changes their username

v1.18.x
Baris Soner Usakli 11 years ago
parent c07bf466b2
commit a97ee201d8

@ -21,6 +21,10 @@ var fs = require('fs'),
log(uid,'changed email from "' + oldEmail + '" to "' + newEmail +'"');
}
events.logUsernameChange = function(uid, oldUsername, newUsername) {
log(uid,'changed username from "' + oldUsername + '" to "' + newUsername +'"');
}
events.logAdminLogin = function(uid) {
log(uid, 'logged into admin panel');
}

@ -285,7 +285,7 @@ var winston = require('winston'),
}
ThreadTools.getLatestUndeletedPid = function(tid, callback) {
db.getSortedSetRange('tid:' + tid + ':posts', 0, -1, function(err, pids) {
db.getSortedSetRevRange('tid:' + tid + ':posts', 0, -1, function(err, pids) {
if(err) {
return callback(err);
}
@ -293,14 +293,9 @@ var winston = require('winston'),
return callback(new Error('no-undeleted-pids-found'));
}
pids.reverse();
async.detectSeries(pids, function(pid, next) {
posts.getPostField(pid, 'deleted', function(err, deleted) {
if (parseInt(deleted, 10) === 0) {
next(true);
} else {
next(false);
}
next(parseInt(deleted, 10) === 0);
});
}, function(pid) {
if (pid) {

@ -982,7 +982,7 @@ var async = require('async'),
return callback(err, null);
}
posts.getPostFields(pid, ['pid', 'content', 'uid', 'timestamp'], function(err, postData) {
posts.getPostFields(pid, ['pid', 'uid', 'timestamp'], function(err, postData) {
if (err) {
return callback(err, null);
} else if(!postData) {
@ -994,26 +994,13 @@ var async = require('async'),
return callback(err, null);
}
var stripped = postData.content,
timestamp = postData.timestamp,
returnObj = {
"pid": postData.pid,
"username": userData.username || 'anonymous',
"userslug": userData.userslug,
"picture": userData.picture || gravatar.url('', {}, https = nconf.get('https')),
"timestamp": timestamp
};
if (postData.content) {
stripped = postData.content.replace(/>.+\n\n/, '');
postTools.parse(stripped, function(err, stripped) {
returnObj.text = S(stripped).stripTags().s;
callback(null, returnObj);
});
} else {
returnObj.text = '';
callback(null, returnObj);
}
callback(null, {
pid: postData.pid,
username: userData.username || 'anonymous',
userslug: userData.userslug,
picture: userData.picture || gravatar.url('', {}, https = nconf.get('https')),
timestamp: postData.timestamp
});
});
});
});

@ -312,6 +312,7 @@ var bcrypt = require('bcrypt'),
db.searchRemove('user', uid, function() {
db.searchIndex('user', data.username, uid);
});
events.logUsernameChange(uid, userData.username, data.username);
}
if(userslug !== userData.userslug) {

Loading…
Cancel
Save