web: cancel attachments caching on disabling offline mode

This commit is contained in:
Abdullah Atta
2024-08-03 11:20:42 +05:00
committed by Abdullah Atta
parent 02fdec74ce
commit 5357be4741
3 changed files with 8 additions and 7 deletions

View File

@@ -209,10 +209,13 @@ class SettingStore extends BaseStore<SettingStore> {
await desktop?.updater.toggleAutoUpdates.mutate({ enabled: !autoUpdates });
};
toggleFullOfflineMode = async () => {
toggleFullOfflineMode = () => {
const isFullOfflineMode = this.get().isFullOfflineMode;
this.set({ isFullOfflineMode: !isFullOfflineMode });
Config.set("fullOfflineMode", !isFullOfflineMode);
if (isFullOfflineMode) db.fs().cancel("offline-mode");
else db.attachments.cacheAttachments();
};
}

View File

@@ -208,11 +208,9 @@ class Sync {
if (this.uncachedAttachments.length > 0 && options.offlineMode) {
await this.db
.fs()
.queueDownloads(
this.uncachedAttachments,
"download-uncached-attachments",
{ readOnDownload: false }
);
.queueDownloads(this.uncachedAttachments, "offline-mode", {
readOnDownload: false
});
this.uncachedAttachments = [];
}
}

View File

@@ -364,7 +364,7 @@ export class Attachments implements ICollection {
filename: a.hash,
chunkSize: a.chunkSize
})),
"download-all-attachments",
"offline-mode",
{ readOnDownload: false }
);
}