mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
api: in getStats(), directly rewrote activePads as an expression
Instead of creating an empty Set and then mutate it.
This commit is contained in:
parent
82b919fc65
commit
4ef59bbda0
1 changed files with 3 additions and 6 deletions
|
@ -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();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue