make sure the attribute is not duplicated in TreeCache and NoteCache, #1278

This commit is contained in:
zadam 2020-09-30 22:34:18 +02:00
parent d163289003
commit cba9b92202
5 changed files with 32 additions and 4 deletions

View File

@ -373,6 +373,7 @@ class Note extends Entity {
return false;
}
// FIXME: this code is quite questionable, one problem is that other caches (TreeCache, NoteCache) have nothing like that
if (attr.isDefinition()) {
const firstDefinitionIndex = attributes.findIndex(el => el.type === attr.type && el.name === attr.name);

View File

@ -205,7 +205,16 @@ class NoteShort {
}
}
noteAttributeCache.attributes[this.noteId] = attrArrs.flat();
noteAttributeCache.attributes[this.noteId] = [];
const addedAttributeIds = new Set();
for (const attr of attrArrs.flat()) {
if (!addedAttributeIds.has(attr.attributeId)) {
addedAttributeIds.add(attr.attributeId);
noteAttributeCache.attributes[this.noteId].push(attr);
}
}
}
return noteAttributeCache.attributes[this.noteId];

View File

@ -852,7 +852,10 @@ ul.fancytree-container li {
contain: layout paint;
}
/** ckeditor's autocomplete */
/**
ckeditor's autocomplete
should be higher than 1070 of tooltip
*/
.ck.ck-balloon-panel {
z-index: 1001;
z-index: 1101;
}

View File

@ -92,7 +92,18 @@ class Note {
}
}
this.attributeCache = parentAttributes.concat(templateAttributes);
this.attributeCache = [];
const addedAttributeIds = new Set();
for (const attr of parentAttributes.concat(templateAttributes)) {
if (!addedAttributeIds.has(attr.attributeId)) {
addedAttributeIds.add(attr.attributeId);
this.attributeCache.push(attr);
}
}
this.inheritableAttributeCache = [];
for (const attr of this.attributeCache) {

View File

@ -106,6 +106,10 @@ function buildRewardMap(note) {
addToRewardMap(attr.name, reward);
}
if (attr.name === 'cliptype') {
reward /= 2;
}
let value = attr.value;
if (value.startsWith('http')) {