Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: sync deleted attachments

thecodrr462afb5536f1
diff --git a/packages/core/api/sync/collector.js b/packages/core/api/sync/collector.js
index 8dc60bfd6..cb4086d20 100644
--- a/packages/core/api/sync/collector.js
+++ b/packages/core/api/sync/collector.js
@@ -20,7 +20,7 @@ class Collector {
notebooks: await this._encrypt(this._collect(this._db.notebooks.raw)),
content: await this._encrypt(this._collect(await this._db.content.all())),
attachments: await this._encrypt(
- this._collect(this._db.attachments.uploaded)
+ this._collect(this._db.attachments.syncable)
),
settings: await this._encrypt(this._collect([this._db.settings.raw])),
vaultKey: await this._serialize(await this._db.vault._getKey()),
diff --git a/packages/core/collections/attachments.js b/packages/core/collections/attachments.js
index a864c042d..1d990ce71 100644
--- a/packages/core/collections/attachments.js
+++ b/packages/core/collections/attachments.js
@@ -322,6 +322,12 @@ export default class Attachments extends Collection {
return this.all.filter((attachment) => attachment.dateUploaded > 0);
}
+ get syncable() {
+ return this.all.filter(
+ (attachment) => attachment.dateUploaded > 0 || attachment.deleted
+ );
+ }
+
get deleted() {
return this.all.filter((attachment) => attachment.dateDeleted > 0);
}