diff --git a/src/topics/delete.js b/src/topics/delete.js index e44e332a1a..e80a20ac75 100644 --- a/src/topics/delete.js +++ b/src/topics/delete.js @@ -74,7 +74,7 @@ module.exports = function (Topics) { db.sortedSetAdd('topics:views', topicData.viewcount, tid, next); }, function (next) { - db.sortedSetAdd('topics:votes', topicData.votes, tid, next); + db.sortedSetAdd('topics:votes', parseInt(topicData.votes, 10) || 0, tid, next); }, function (next) { async.waterfall([ diff --git a/src/topics/tools.js b/src/topics/tools.js index 2ec4de624d..b28b8d12d4 100644 --- a/src/topics/tools.js +++ b/src/topics/tools.js @@ -186,7 +186,7 @@ module.exports = function (Topics) { async.apply(db.sortedSetRemove, 'cid:' + topicData.cid + ':tids:pinned', tid), async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids', topicData.lastposttime, tid), async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:posts', topicData.postcount, tid), - async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:votes', topicData.votes, tid), + async.apply(db.sortedSetAdd, 'cid:' + topicData.cid + ':tids:votes', parseInt(topicData.votes, 10) || 0, tid), ], next); } },