PadMessageHandler: Improve readability of historical author fetch

This commit is contained in:
Richard Hansen 2021-10-30 00:46:05 -04:00
parent d36a37d666
commit 0992f19570
1 changed files with 3 additions and 2 deletions

View File

@ -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