From 728e7bdae95777db9abe8266492d40f38deeeb33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 23 Oct 2018 21:36:18 -0400 Subject: [PATCH] remove more parseInts --- src/socket.io/categories.js | 5 ----- src/topics/tools.js | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/socket.io/categories.js b/src/socket.io/categories.js index 3a1ebf883b..7b76c3b80c 100644 --- a/src/socket.io/categories.js +++ b/src/socket.io/categories.js @@ -188,11 +188,6 @@ function ignoreOrWatch(fn, socket, cid, callback) { categories.getCategoriesFields(cids, ['cid', 'parentCid'], next); }, function (categoryData, next) { - categoryData.forEach(function (c) { - c.cid = parseInt(c.cid, 10); - c.parentCid = parseInt(c.parentCid, 10); - }); - // filter to subcategories of cid var cat; do { diff --git a/src/topics/tools.js b/src/topics/tools.js index ae727602c8..a34eead8e6 100644 --- a/src/topics/tools.js +++ b/src/topics/tools.js @@ -246,7 +246,7 @@ module.exports = function (Topics) { topicTools.move = function (tid, data, callback) { var topic; var oldCid; - var cid = data.cid; + var cid = parseInt(data.cid, 10); async.waterfall([ function (next) { @@ -257,7 +257,7 @@ module.exports = function (Topics) { if (!topic) { return next(new Error('[[error:no-topic]]')); } - if (parseInt(cid, 10) === parseInt(topic.cid, 10)) { + if (cid === topic.cid) { return next(new Error('[[error:cant-move-topic-to-same-category]]')); } db.sortedSetsRemove([ @@ -277,7 +277,7 @@ module.exports = function (Topics) { db.sortedSetAdd('cid:' + cid + ':uid:' + topic.uid + ':tids', topic.timestamp, tid, next); }, function (next) { - if (parseInt(topic.pinned, 10)) { + if (topic.pinned) { db.sortedSetAdd('cid:' + cid + ':tids:pinned', Date.now(), tid, next); } else { async.parallel([