mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
ExportEtherpad: Simplify attribute pool iteration
This commit is contained in:
parent
3004bc1583
commit
56a60a34fb
1 changed files with 4 additions and 6 deletions
|
@ -32,13 +32,11 @@ exports.getPadRaw = async (padId, readOnlyId) => {
|
||||||
for (const keySuffix of keySuffixes) {
|
for (const keySuffix of keySuffixes) {
|
||||||
const entry = data[keyPrefixWrite + keySuffix] = await db.get(keyPrefixRead + keySuffix);
|
const entry = data[keyPrefixWrite + keySuffix] = await db.get(keyPrefixRead + keySuffix);
|
||||||
if (!entry.pool || !entry.pool.numToAttrib) continue;
|
if (!entry.pool || !entry.pool.numToAttrib) continue;
|
||||||
const authors = entry.pool.numToAttrib;
|
for (const [k, v] of Object.values(entry.pool.numToAttrib)) {
|
||||||
for (const k of Object.keys(authors)) {
|
if (k !== 'author') continue;
|
||||||
if (authors[k][0] !== 'author') continue;
|
const authorEntry = await db.get(`globalAuthor:${v}`);
|
||||||
const authorId = authors[k][1];
|
|
||||||
const authorEntry = await db.get(`globalAuthor:${authorId}`);
|
|
||||||
if (!authorEntry) continue;
|
if (!authorEntry) continue;
|
||||||
data[`globalAuthor:${authorId}`] = authorEntry;
|
data[`globalAuthor:${v}`] = authorEntry;
|
||||||
if (!authorEntry.padIDs) continue;
|
if (!authorEntry.padIDs) continue;
|
||||||
authorEntry.padIDs = readOnlyId || padId;
|
authorEntry.padIDs = readOnlyId || padId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue