Skip to content

Commit 5b3575a

Browse files
committed
ImportEtherpad: Use AttributePool to check attributes
1 parent 19909ea commit 5b3575a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/node/utils/ImportEtherpad.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19+
const AttributePool = require('../../static/js/AttributePool');
1920
const {Pad} = require('../db/Pad');
2021
const authorManager = require('../db/AuthorManager');
2122
const db = require('../db/DB');
@@ -72,11 +73,12 @@ exports.setPadRaw = async (padId, r) => {
7273
value.padIDs = {[padId]: 1};
7374
} else if (padKeyPrefixes.includes(prefix)) {
7475
checkOriginalPadId(id);
75-
if (prefix === 'pad' && keyParts.length === 2 && value.pool) {
76+
if (prefix === 'pad' && keyParts.length === 2) {
77+
const pool = new AttributePool().fromJsonable(value.pool);
7678
const unsupportedElements = new Set();
77-
for (const [k] of Object.values(value.pool.numToAttrib)) {
79+
pool.eachAttrib((k, v) => {
7880
if (!supportedElems.has(k)) unsupportedElements.add(k);
79-
}
81+
});
8082
if (unsupportedElements.size) {
8183
logger.warn(`(pad ${padId}) unsupported attributes (try installing a plugin): ` +
8284
`${[...unsupportedElements].join(', ')}`);

0 commit comments

Comments
 (0)