1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

All: Started resource fetcher service when a note has been decrypted

This commit is contained in:
Laurent Cozic
2020-04-19 10:11:46 +01:00
parent ab63316f83
commit 2b2ec2c655
4 changed files with 31 additions and 3 deletions

View File

@ -137,6 +137,7 @@ class DecryptionWorker {
this.state_ = 'started';
const excludedIds = [];
const decryptedItemCounts = {};
this.dispatch({ type: 'ENCRYPTION_HAS_DISABLED_ITEMS', value: false });
this.dispatchReport({ state: 'started' });
@ -179,6 +180,10 @@ class DecryptionWorker {
await clearDecryptionCounter();
if (!decryptedItemCounts[decryptedItem.type_]) decryptedItemCounts[decryptedItem.type_] = 0;
decryptedItemCounts[decryptedItem.type_]++;
if (decryptedItem.type_ === Resource.modelType() && !!decryptedItem.encryption_blob_encrypted) {
// itemsThatNeedDecryption() will return the resource again if the blob has not been decrypted,
// but that will result in an infinite loop if the blob simply has not been downloaded yet.
@ -240,7 +245,10 @@ class DecryptionWorker {
this.state_ = 'idle';
this.dispatchReport({ state: 'idle' });
this.dispatchReport({
state: 'idle',
decryptedItemCounts: decryptedItemCounts,
});
if (downloadedButEncryptedBlobCount) {
this.logger().info(`DecryptionWorker: Some resources have been downloaded but are not decrypted yet. Scheduling another decryption. Resource count: ${downloadedButEncryptedBlobCount}`);