From 0992f195707b710906becf90003ce315448a8f34 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 30 Oct 2021 00:46:05 -0400 Subject: [PATCH] PadMessageHandler: Improve readability of historical author fetch --- src/node/handler/PadMessageHandler.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 61b9733b..05b9e446 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -833,7 +833,8 @@ const handleClientReady = async (socket, message, authorID) => { // get all author data out of the database (in parallel) const historicalAuthorData = {}; - await Promise.all(authors.map((authorId) => authorManager.getAuthor(authorId).then((author) => { + await Promise.all(authors.map(async (authorId) => { + const author = await authorManager.getAuthor(authorId); if (!author) { messageLogger.error(`There is no author for authorId: ${authorId}. ` + 'This is possibly related to https://github.com/ether/etherpad-lite/issues/2802'); @@ -841,7 +842,7 @@ const handleClientReady = async (socket, message, authorID) => { // Filter author attribs (e.g. don't send author's pads to all clients) historicalAuthorData[authorId] = {name: author.name, colorId: author.colorId}; } - }))); + })); // glue the clientVars together, send them and tell the other clients that a new one is there