mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix a bug which caused immedate deletion of created attributes
This commit is contained in:
parent
23278f54cb
commit
bc8f531b33
@ -274,6 +274,8 @@ class AbstractBeccaEntity {
|
|||||||
[this.dateModified, entityId]);
|
[this.dateModified, entityId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.trace("DELETE");
|
||||||
|
|
||||||
log.info(`Marking ${entityName} ${entityId} as deleted`);
|
log.info(`Marking ${entityName} ${entityId} as deleted`);
|
||||||
|
|
||||||
this.addEntityChange(true);
|
this.addEntityChange(true);
|
||||||
@ -291,6 +293,8 @@ class AbstractBeccaEntity {
|
|||||||
WHERE ${this.constructor.primaryKeyName} = ?`,
|
WHERE ${this.constructor.primaryKeyName} = ?`,
|
||||||
[this.utcDateModified, entityId]);
|
[this.utcDateModified, entityId]);
|
||||||
|
|
||||||
|
console.trace("DELETE");
|
||||||
|
|
||||||
log.info(`Marking ${entityName} ${entityId} as deleted`);
|
log.info(`Marking ${entityName} ${entityId} as deleted`);
|
||||||
|
|
||||||
this.addEntityChange(true);
|
this.addEntityChange(true);
|
||||||
|
@ -317,6 +317,9 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Beware that the method must not create a copy of the array, but actually returns its internal array
|
||||||
|
* (for performance reasons)
|
||||||
|
*
|
||||||
* @param {string} [type] - (optional) attribute type to filter
|
* @param {string} [type] - (optional) attribute type to filter
|
||||||
* @param {string} [name] - (optional) attribute name to filter
|
* @param {string} [name] - (optional) attribute name to filter
|
||||||
* @returns {BAttribute[]} all note's attributes, including inherited ones
|
* @returns {BAttribute[]} all note's attributes, including inherited ones
|
||||||
@ -335,7 +338,6 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
return this.__attributeCache.filter(attr => attr.name === name);
|
return this.__attributeCache.filter(attr => attr.name === name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// a bit unsafe to return the original array, but defensive copy would be costly
|
|
||||||
return this.__attributeCache;
|
return this.__attributeCache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -646,6 +648,9 @@ class BNote extends AbstractBeccaEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Beware that the method must not create a copy of the array, but actually returns its internal array
|
||||||
|
* (for performance reasons)
|
||||||
|
*
|
||||||
* @param {string|null} [type] - (optional) attribute type to filter
|
* @param {string|null} [type] - (optional) attribute type to filter
|
||||||
* @param {string|null} [name] - (optional) attribute name to filter
|
* @param {string|null} [name] - (optional) attribute name to filter
|
||||||
* @param {string|null} [value] - (optional) attribute value to filter
|
* @param {string|null} [value] - (optional) attribute value to filter
|
||||||
|
@ -116,7 +116,7 @@ function updateNoteAttributes(req) {
|
|||||||
|
|
||||||
const note = becca.getNote(noteId);
|
const note = becca.getNote(noteId);
|
||||||
|
|
||||||
let existingAttrs = note.getOwnedAttributes();
|
let existingAttrs = note.getOwnedAttributes().slice();
|
||||||
|
|
||||||
let position = 0;
|
let position = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user