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

This commit is contained in:
Baris Soner Usakli
2014-01-13 18:02:06 -05:00
parent c07bf466b2
commit a97ee201d8
4 changed files with 15 additions and 28 deletions

View File

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