mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 07:06:47 +02:00
refactor: use set
This commit is contained in:
@@ -318,16 +318,16 @@ Sockets.getUidsInRoom = async function (room) {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const ioRoom = Sockets.server.in(room);
|
const ioRoom = Sockets.server.in(room);
|
||||||
const uids = [];
|
const uids = new Set();
|
||||||
if (ioRoom) {
|
if (ioRoom) {
|
||||||
const sockets = await ioRoom.fetchSockets();
|
const sockets = await ioRoom.fetchSockets();
|
||||||
for (const s of sockets) {
|
for (const s of sockets) {
|
||||||
if (s && s.data && s.data.uid > 0) {
|
if (s && s.data && s.data.uid > 0) {
|
||||||
uids.push(s.data.uid);
|
uids.add(s.data.uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _.uniq(uids);
|
return [...uids];
|
||||||
};
|
};
|
||||||
|
|
||||||
Sockets.warnDeprecated = (socket, replacement) => {
|
Sockets.warnDeprecated = (socket, replacement) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user