From 0f63f67b77e8ea50720bff5e0f3c8a9549824f4e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 5 Sep 2024 12:41:25 -0400 Subject: [PATCH] fix: type casting in user block logic --- src/user/blocks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/user/blocks.js b/src/user/blocks.js index 66465012b3..aa8425fe96 100644 --- a/src/user/blocks.js +++ b/src/user/blocks.js @@ -54,8 +54,8 @@ module.exports = function (User) { if (unCachedUids.length) { const unCachedData = await db.getSortedSetsMembers(unCachedUids.map(uid => `uid:${uid}:blocked_uids`)); unCachedUids.forEach((uid, index) => { - cachedData[uid] = (unCachedData[index] || []).map(uid => String(uid)); - User.blocks._cache.set(uid, cachedData[uid]); + cachedData[uid] = (unCachedData[index] || []).map(uid => (utils.isNumber(uid) ? parseInt(uid, 10) : uid)); + User.blocks._cache.set(String(uid), cachedData[uid]); }); } const result = uids.map(uid => cachedData[uid] || []);