Skip to content

Commit 36bfdcd

Browse files
committed
Use Map for liveRoleIdToCountMap to avoid object injection warning
1 parent 730d955 commit 36bfdcd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/discordactions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,13 @@ const enrichGroupDataWithMembershipInfo = async (discordId, groups = []) => {
329329

330330
// Discord live role membership (used for memberCount)
331331
const discordMembers = await getDiscordMembers();
332-
const liveRoleIdToCountMap = {};
332+
const liveRoleIdToCountMap = new Map();
333333

334334
discordMembers.forEach((member) => {
335335
if (!member.roles) return;
336336

337337
member.roles.forEach((roleId) => {
338-
liveRoleIdToCountMap[roleId] = (liveRoleIdToCountMap[roleId] || 0) + 1;
338+
liveRoleIdToCountMap.set(roleId, (liveRoleIdToCountMap.get(roleId) || 0) + 1);
339339
});
340340
});
341341

0 commit comments

Comments
 (0)