import/export: Simplify exportEtherpadAdditionalContent processing

Also:
  * Improve parallelization
  * Refine the documentation
This commit is contained in:
Richard Hansen 2020-11-10 01:20:05 -05:00 committed by John McLear
parent 8c55a38582
commit 6a8563eeab
3 changed files with 22 additions and 28 deletions

View file

@ -65,17 +65,11 @@ exports.setPadRaw = function(padId, records)
}
// is this a key that is supported through a plugin?
await Promise.all([
// get content that has a different prefix IE comments:padId:foo
// a plugin would return something likle ["comments", "cakes"]
hooks.aCallAll('exportEtherpadAdditionalContent').then((prefixes) => {
prefixes.forEach(async function(prefix) {
if(key.split(":")[0] === prefix){
newKey = prefix + ":" + padId;
}
});
})
]);
// get content that has a different prefix IE comments:padId:foo
// a plugin would return something likle ['comments', 'cakes']
for (const prefix of await hooks.aCallAll('exportEtherpadAdditionalContent')) {
if (prefix === oldPadId[0]) newKey = `${prefix}:${padId}`;
}
}
// Write the value to the server