mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-04 21:15:55 +01:00
remove parseInts
This commit is contained in:
@@ -48,9 +48,7 @@ module.exports = function (Topics) {
|
||||
if (!Array.isArray(postData) || !postData.length) {
|
||||
return callback(null, []);
|
||||
}
|
||||
var pids = postData.map(function (post) {
|
||||
return post && post.pid;
|
||||
});
|
||||
var pids = postData.map(post => post && post.pid);
|
||||
|
||||
if (!Array.isArray(pids) || !pids.length) {
|
||||
return callback(null, []);
|
||||
@@ -105,15 +103,14 @@ module.exports = function (Topics) {
|
||||
function (results, next) {
|
||||
postData.forEach(function (postObj, i) {
|
||||
if (postObj) {
|
||||
postObj.deleted = parseInt(postObj.deleted, 10) === 1;
|
||||
postObj.user = parseInt(postObj.uid, 10) ? results.userData[postObj.uid] : _.clone(results.userData[postObj.uid]);
|
||||
postObj.user = postObj.uid ? results.userData[postObj.uid] : _.clone(results.userData[postObj.uid]);
|
||||
postObj.editor = postObj.editor ? results.editors[postObj.editor] : null;
|
||||
postObj.bookmarked = results.bookmarks[i];
|
||||
postObj.upvoted = results.voteData.upvotes[i];
|
||||
postObj.downvoted = results.voteData.downvotes[i];
|
||||
postObj.votes = postObj.votes || 0;
|
||||
postObj.replies = results.replies[i];
|
||||
postObj.selfPost = !!parseInt(uid, 10) && parseInt(uid, 10) === parseInt(postObj.uid, 10);
|
||||
postObj.selfPost = !!parseInt(uid, 10) && parseInt(uid, 10) === postObj.uid;
|
||||
|
||||
// Username override for guests, if enabled
|
||||
if (meta.config.allowGuestHandles && postObj.uid === 0 && postObj.handle) {
|
||||
@@ -238,7 +235,7 @@ module.exports = function (Topics) {
|
||||
posts.getPostField(pids[0], 'deleted', _next);
|
||||
},
|
||||
function (deleted, _next) {
|
||||
isDeleted = parseInt(deleted, 10) === 1;
|
||||
isDeleted = deleted;
|
||||
if (!isDeleted) {
|
||||
latestPid = pids[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user