mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix undeleting notes with a relation, closes #3583
This commit is contained in:
parent
290f7e2101
commit
e7c6d912a4
@ -80,14 +80,14 @@ class AbstractEntity {
|
||||
*
|
||||
* @returns {this}
|
||||
*/
|
||||
save() {
|
||||
save(opts = {}) {
|
||||
const entityName = this.constructor.entityName;
|
||||
const primaryKeyName = this.constructor.primaryKeyName;
|
||||
|
||||
const isNewEntity = !this[primaryKeyName];
|
||||
|
||||
if (this.beforeSaving) {
|
||||
this.beforeSaving();
|
||||
this.beforeSaving(opts);
|
||||
}
|
||||
|
||||
const pojo = this.getPojoToSave();
|
||||
|
@ -176,8 +176,10 @@ class Attribute extends AbstractEntity {
|
||||
return !(this.attributeId in this.becca.attributes);
|
||||
}
|
||||
|
||||
beforeSaving() {
|
||||
this.validate();
|
||||
beforeSaving(opts = {}) {
|
||||
if (!opts.skipValidation) {
|
||||
this.validate();
|
||||
}
|
||||
|
||||
this.name = sanitizeAttributeName(this.name);
|
||||
|
||||
|
@ -661,7 +661,8 @@ function undeleteBranch(branchId, deleteId, taskContext) {
|
||||
OR (type = 'relation' AND value = ?))`, [deleteId, note.noteId, note.noteId]);
|
||||
|
||||
for (const attribute of attributes) {
|
||||
new Attribute(attribute).save();
|
||||
// relation might point to a note which hasn't been undeleted yet and would thus throw up
|
||||
new Attribute(attribute).save({skipValidation: true});
|
||||
}
|
||||
|
||||
const childBranchIds = sql.getColumn(`
|
||||
|
Loading…
x
Reference in New Issue
Block a user