mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
ImportEtherpad: Warn about unsupported attrib at encounter
This commit is contained in:
parent
23f8a12922
commit
ad78b24113
1 changed files with 5 additions and 7 deletions
|
@ -32,8 +32,6 @@ exports.setPadRaw = async (padId, r) => {
|
||||||
supportedElems.add(element);
|
supportedElems.add(element);
|
||||||
});
|
});
|
||||||
|
|
||||||
const unsupportedElements = new Set();
|
|
||||||
|
|
||||||
// DB key prefixes for pad records. Each key is expected to have the form `${prefix}:${padId}` or
|
// DB key prefixes for pad records. Each key is expected to have the form `${prefix}:${padId}` or
|
||||||
// `${prefix}:${padId}:${otherstuff}`.
|
// `${prefix}:${padId}:${otherstuff}`.
|
||||||
const padKeyPrefixes = [
|
const padKeyPrefixes = [
|
||||||
|
@ -74,9 +72,14 @@ exports.setPadRaw = async (padId, r) => {
|
||||||
} else if (padKeyPrefixes.includes(prefix)) {
|
} else if (padKeyPrefixes.includes(prefix)) {
|
||||||
checkOriginalPadId(id);
|
checkOriginalPadId(id);
|
||||||
if (prefix === 'pad' && keyParts.length === 2 && value.pool) {
|
if (prefix === 'pad' && keyParts.length === 2 && value.pool) {
|
||||||
|
const unsupportedElements = new Set();
|
||||||
for (const [k] of Object.values(value.pool.numToAttrib)) {
|
for (const [k] of Object.values(value.pool.numToAttrib)) {
|
||||||
if (!supportedElems.has(k)) unsupportedElements.add(k);
|
if (!supportedElems.has(k)) unsupportedElements.add(k);
|
||||||
}
|
}
|
||||||
|
if (unsupportedElements.size) {
|
||||||
|
logger.warn(`(pad ${padId}) unsupported attributes (try installing a plugin): ` +
|
||||||
|
`${[...unsupportedElements].join(', ')}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
keyParts[1] = padId;
|
keyParts[1] = padId;
|
||||||
key = keyParts.join(':');
|
key = keyParts.join(':');
|
||||||
|
@ -87,11 +90,6 @@ exports.setPadRaw = async (padId, r) => {
|
||||||
dbRecords.set(key, value);
|
dbRecords.set(key, value);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (unsupportedElements.size) {
|
|
||||||
logger.warn('Ignoring unsupported elements (you might want to install a plugin): ' +
|
|
||||||
`${[...unsupportedElements].join(', ')}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
...[...dbRecords].map(async ([k, v]) => await db.set(k, v)),
|
...[...dbRecords].map(async ([k, v]) => await db.set(k, v)),
|
||||||
...[...existingAuthors].map(async (authorId) => await authorManager.addPad(authorId, padId)),
|
...[...existingAuthors].map(async (authorId) => await authorManager.addPad(authorId, padId)),
|
||||||
|
|
Loading…
Reference in a new issue