ImportEtherpad: Use AttributePool to check attributes
parent
19909eae53
commit
5b3575acf0
|
@ -16,6 +16,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const AttributePool = require('../../static/js/AttributePool');
|
||||||
const {Pad} = require('../db/Pad');
|
const {Pad} = require('../db/Pad');
|
||||||
const authorManager = require('../db/AuthorManager');
|
const authorManager = require('../db/AuthorManager');
|
||||||
const db = require('../db/DB');
|
const db = require('../db/DB');
|
||||||
|
@ -72,11 +73,12 @@ exports.setPadRaw = async (padId, r) => {
|
||||||
value.padIDs = {[padId]: 1};
|
value.padIDs = {[padId]: 1};
|
||||||
} 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) {
|
||||||
|
const pool = new AttributePool().fromJsonable(value.pool);
|
||||||
const unsupportedElements = new Set();
|
const unsupportedElements = new Set();
|
||||||
for (const [k] of Object.values(value.pool.numToAttrib)) {
|
pool.eachAttrib((k, v) => {
|
||||||
if (!supportedElems.has(k)) unsupportedElements.add(k);
|
if (!supportedElems.has(k)) unsupportedElements.add(k);
|
||||||
}
|
});
|
||||||
if (unsupportedElements.size) {
|
if (unsupportedElements.size) {
|
||||||
logger.warn(`(pad ${padId}) unsupported attributes (try installing a plugin): ` +
|
logger.warn(`(pad ${padId}) unsupported attributes (try installing a plugin): ` +
|
||||||
`${[...unsupportedElements].join(', ')}`);
|
`${[...unsupportedElements].join(', ')}`);
|
||||||
|
|
Loading…
Reference in New Issue