A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
core: do not update dateModified when updating content internally
Abdullah Attafe1ea6dc27a6
diff --git a/packages/core/src/collections/content.ts b/packages/core/src/collections/content.tsindex b594f8245..b845532f8 100644--- a/packages/core/src/collections/content.ts+++ b/packages/core/src/collections/content.ts@@ -175,10 +175,7 @@ export class Content implements ICollection {const content = await this.collection.get(id);if (!content || isDeleted(content)) return;if (!content.locked && this.preProcess(content)) {- await this.db.content.add({- ...content,- sessionId: `${Date.now()}`- });+ await this.collection.update([content.id], content, { modify: false });}return content;}@@ -246,10 +243,7 @@ export class Content implements ICollection {.executeTakeFirst()) as ContentItem;if (!content || isDeleted(content)) return;if (!content.locked && this.preProcess(content)) {- await this.db.content.add({- ...content,- sessionId: `${Date.now()}`- });+ await this.collection.update([content.id], content, { modify: false });}return content;}diff --git a/packages/core/src/database/sql-collection.ts b/packages/core/src/database/sql-collection.tsindex d78e03892..42a29cd49 100644--- a/packages/core/src/database/sql-collection.ts+++ b/packages/core/src/database/sql-collection.ts@@ -227,14 +227,16 @@ export class SQLCollection<ids: string[],partial: Partial<SQLiteItem<T>>,options: {- sendEvent: boolean;+ sendEvent?: boolean;+ modify?: boolean;condition?: ExpressionOrFactory<DatabaseSchema,keyof DatabaseSchema,SqlBool>;- } = { sendEvent: true }+ } = {}) {+ const { sendEvent = true, modify = true, condition } = options;if (!this.sanitizer.sanitize(this.type, partial)) return;await this.db()@@ -244,16 +246,16 @@ export class SQLCollection<await tx.updateTable<keyof DatabaseSchema>(this.type).where("id", "in", chunk)- .$if(!!options.condition, (eb) => eb.where(options.condition!))+ .$if(!!condition, (eb) => eb.where(condition!)).set({...partial,- dateModified: Date.now(),+ dateModified: modify ? Date.now() : undefined,synced: partial.synced || false}).execute();}});- if (options.sendEvent) {+ if (sendEvent) {this.eventManager.publish(EVENTS.databaseUpdated, <UpdateEvent>{type: "update",collection: this.type,