mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +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) {
|
||||
const entry = data[keyPrefixWrite + keySuffix] = await db.get(keyPrefixRead + keySuffix);
|
||||
if (!entry.pool || !entry.pool.numToAttrib) continue;
|
||||
const authors = entry.pool.numToAttrib;
|
||||
for (const k of Object.keys(authors)) {
|
||||
if (authors[k][0] !== 'author') continue;
|
||||
const authorId = authors[k][1];
|
||||
const authorEntry = await db.get(`globalAuthor:${authorId}`);
|
||||
for (const [k, v] of Object.values(entry.pool.numToAttrib)) {
|
||||
if (k !== 'author') continue;
|
||||
const authorEntry = await db.get(`globalAuthor:${v}`);
|
||||
if (!authorEntry) continue;
|
||||
data[`globalAuthor:${authorId}`] = authorEntry;
|
||||
data[`globalAuthor:${v}`] = authorEntry;
|
||||
if (!authorEntry.padIDs) continue;
|
||||
authorEntry.padIDs = readOnlyId || padId;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue