ImportEtherpad: Fix async logic
parent
b7065eb9a0
commit
9bc90128cb
|
@ -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): ' +
|
||||||
|
|
Loading…
Reference in New Issue