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
feat: send groupId with attachment progress events
thecodrr522465829741
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.jsindex 1d283ec05..cbafe9f70 100644--- a/packages/core/api/sync/index.js+++ b/packages/core/api/sync/index.js@@ -154,10 +154,9 @@ export default class Sync {try {console.log("Uploading attachments", this._db.attachments.pending);for (var i = 0; i < attachments.length; ++i) {- sendAttachmentsProgressEvent("upload", attachments.length, i);-const attachment = attachments[i];const { hash } = attachment.metadata;+ sendAttachmentsProgressEvent("upload", hash, attachments.length, i);const isUploaded = await this._db.fs.uploadFile(hash, hash);if (!isUploaded) throw new Error("Failed to upload file.");@@ -167,7 +166,7 @@ export default class Sync {} catch (e) {throw new Error("Failed to upload attachments. Error: " + e.message);} finally {- sendAttachmentsProgressEvent("upload", attachments.length);+ sendAttachmentsProgressEvent("upload", null, attachments.length);}}}diff --git a/packages/core/collections/attachments.js b/packages/core/collections/attachments.jsindex 4f3c0cd28..c2990511d 100644--- a/packages/core/collections/attachments.js+++ b/packages/core/collections/attachments.js@@ -186,7 +186,7 @@ export default class Attachments extends Collection {}async _downloadMedia(hash, { total, current, groupId }) {- sendAttachmentsProgressEvent("download", total, current);+ sendAttachmentsProgressEvent("download", groupId, total, current);try {const isDownloaded = await this._db.fs.downloadFile(groupId, hash);if (!isDownloaded) return;@@ -202,7 +202,7 @@ export default class Attachments extends Collection {return src;} finally {if (1 + current === total)- sendAttachmentsProgressEvent("download", total);+ sendAttachmentsProgressEvent("download", groupId, total);}}diff --git a/packages/core/common.js b/packages/core/common.jsindex 29009739f..eb24f75f5 100644--- a/packages/core/common.js+++ b/packages/core/common.js@@ -10,9 +10,10 @@ export async function sendCheckUserStatusEvent(type) {return results.some((r) => r.type === type && r.result === true);}-export function sendAttachmentsProgressEvent(type, total, current) {+export function sendAttachmentsProgressEvent(type, groupId, total, current) {EV.publish(EVENTS.attachmentsLoading, {type,+ groupId,total,current: current === undefined ? total : current,});