ImportEtherpad: Fix async logic

pull/5304/head
Richard Hansen 2021-11-23 00:34:59 -05:00
parent b7065eb9a0
commit 9bc90128cb
1 changed files with 3 additions and 5 deletions

View File

@ -23,7 +23,7 @@ const supportedElems = require('../../static/js/contentcollector').supportedElem
const logger = log4js.getLogger('ImportEtherpad'); const logger = log4js.getLogger('ImportEtherpad');
exports.setPadRaw = (padId, r) => { exports.setPadRaw = async (padId, r) => {
const records = JSON.parse(r); const records = JSON.parse(r);
// get supported block Elements from plugins, we will use this later. // get supported block Elements from plugins, we will use this later.
@ -33,9 +33,7 @@ exports.setPadRaw = (padId, r) => {
const unsupportedElements = new Set(); const unsupportedElements = new Set();
Object.keys(records).forEach(async (key) => { await Promise.all(Object.entries(records).map(async ([key, value]) => {
let value = records[key];
if (!value) { if (!value) {
return; return;
} }
@ -93,7 +91,7 @@ exports.setPadRaw = (padId, r) => {
// Write the value to the server // Write the value to the server
await db.set(newKey, value); await db.set(newKey, value);
}); }));
if (unsupportedElements.size) { if (unsupportedElements.size) {
logger.warn('Ignoring unsupported elements (you might want to install a plugin): ' + logger.warn('Ignoring unsupported elements (you might want to install a plugin): ' +