Skip to content

Build your personal knowledge base with Trilium Notes

Merge remote-tracking branch 'origin/stable'

zadam2feb778d8dc2
diff --cc src/becca/entities/abstract_entity.js
index 23f280bdcf,4a875e2a95..5fa814a75d
--- a/src/becca/entities/abstract_entity.js
+++ b/src/becca/entities/abstract_entity.js
@@@ -104,34 -103,19 +104,38 @@@ class AbstractEntity
const entityId = this[this.constructor.primaryKeyName];
const entityName = this.constructor.entityName;
+ this.utcDateModified = dateUtils.utcNowDateTime();
+
sql.execute(`UPDATE ${entityName} SET isDeleted = 1, deleteId = ?, utcDateModified = ?
WHERE ${this.constructor.primaryKeyName} = ?`,
- [deleteId, dateUtils.utcNowDateTime(), entityId]);
+ [deleteId, this.utcDateModified, entityId]);
if (this.dateModified) {
+ this.dateModified = dateUtils.localNowDateTime();
+
sql.execute(`UPDATE ${entityName} SET dateModified = ? WHERE ${this.constructor.primaryKeyName} = ?`,
- [dateUtils.localNowDateTime(), entityId]);
+ [this.dateModified, entityId]);
}
+ log.info(`Marking ${entityName} ${entityId} as deleted`);
+
+ this.addEntityChange(true);
+
+ eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this });
+ }
+
+ markAsDeletedSimple() {
+ const entityId = this[this.constructor.primaryKeyName];
+ const entityName = this.constructor.entityName;
+
+ this.utcDateModified = dateUtils.utcNowDateTime();
+
+ sql.execute(`UPDATE ${entityName} SET isDeleted = 1, utcDateModified = ?
+ WHERE ${this.constructor.primaryKeyName} = ?`,
+ [this.utcDateModified, entityId]);
+
+ log.info(`Marking ${entityName} ${entityId} as deleted`);
+
this.addEntityChange(true);
eventService.emit(eventService.ENTITY_DELETED, { entityName, entityId, entity: this });