api: in getStats(), directly rewrote activePads as an expression

Instead of creating an empty Set and then mutate it.
pull/3851/head
muxator 2020-04-04 17:47:12 +02:00 committed by muxator
parent 82b919fc65
commit 4ef59bbda0
1 changed files with 3 additions and 6 deletions

View File

@ -851,13 +851,10 @@ exports.createDiffHTML = async function(padID, startRev, endRev) {
*/ */
exports.getStats = async function() { exports.getStats = async function() {
const sessionKeys = Object.keys(padMessageHandler.sessioninfos); const sessionInfos = padMessageHandler.sessioninfos;
const activePads = new Set(); const sessionKeys = Object.keys(sessionInfos);
const activePads = new Set(Object.entries(sessionInfos).map(k => k[1].padId));
sessionKeys
.map(k => padMessageHandler.sessioninfos[k])
.forEach(o => activePads.add(o.padId));
const { padIDs } = await padManager.listAllPads(); const { padIDs } = await padManager.listAllPads();