ImportEtherpad: Remove unnecessary variable

pull/5304/head
Richard Hansen 2021-11-24 23:39:27 -05:00
parent 9bc90128cb
commit 2f0561abc0
1 changed files with 3 additions and 10 deletions

View File

@ -38,12 +38,9 @@ exports.setPadRaw = async (padId, r) => {
return; return;
} }
let newKey;
if (value.padIDs) { if (value.padIDs) {
// Author data - rewrite author pad ids // Author data - rewrite author pad ids
value.padIDs[padId] = 1; value.padIDs[padId] = 1;
newKey = key;
// Does this author already exist? // Does this author already exist?
const author = await db.get(key); const author = await db.get(key);
@ -76,21 +73,17 @@ exports.setPadRaw = async (padId, r) => {
if (oldPadId[0] === 'pad') { if (oldPadId[0] === 'pad') {
// so set the new pad id for the author // so set the new pad id for the author
oldPadId[1] = padId; oldPadId[1] = padId;
key = oldPadId.join(':');
// and create the value
newKey = oldPadId.join(':'); // create the new key
} }
// is this a key that is supported through a plugin? // is this a key that is supported through a plugin?
// get content that has a different prefix IE comments:padId:foo // get content that has a different prefix IE comments:padId:foo
// a plugin would return something likle ['comments', 'cakes'] // a plugin would return something likle ['comments', 'cakes']
for (const prefix of await hooks.aCallAll('exportEtherpadAdditionalContent')) { for (const prefix of await hooks.aCallAll('exportEtherpadAdditionalContent')) {
if (prefix === oldPadId[0]) newKey = `${prefix}:${padId}`; if (prefix === oldPadId[0]) key = `${prefix}:${padId}`;
} }
} }
await db.set(key, value);
// Write the value to the server
await db.set(newKey, value);
})); }));
if (unsupportedElements.size) { if (unsupportedElements.size) {