mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: type casting in user block logic
This commit is contained in:
@@ -54,8 +54,8 @@ module.exports = function (User) {
|
|||||||
if (unCachedUids.length) {
|
if (unCachedUids.length) {
|
||||||
const unCachedData = await db.getSortedSetsMembers(unCachedUids.map(uid => `uid:${uid}:blocked_uids`));
|
const unCachedData = await db.getSortedSetsMembers(unCachedUids.map(uid => `uid:${uid}:blocked_uids`));
|
||||||
unCachedUids.forEach((uid, index) => {
|
unCachedUids.forEach((uid, index) => {
|
||||||
cachedData[uid] = (unCachedData[index] || []).map(uid => String(uid));
|
cachedData[uid] = (unCachedData[index] || []).map(uid => (utils.isNumber(uid) ? parseInt(uid, 10) : uid));
|
||||||
User.blocks._cache.set(uid, cachedData[uid]);
|
User.blocks._cache.set(String(uid), cachedData[uid]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const result = uids.map(uid => cachedData[uid] || []);
|
const result = uids.map(uid => cachedData[uid] || []);
|
||||||
|
|||||||
Reference in New Issue
Block a user