1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

Handle sync when resource has been edited

This commit is contained in:
Laurent Cozic
2020-05-31 00:31:29 +01:00
parent 0e5a0fdbe5
commit 1852d9291d
7 changed files with 63 additions and 8 deletions

View File

@@ -110,8 +110,16 @@ class Resource extends BaseItem {
}
static async isReady(resource) {
const r = await this.readyStatus(resource);
return r === 'ok';
}
static async readyStatus(resource) {
const ls = await this.localState(resource);
return resource && ls.fetch_status === Resource.FETCH_STATUS_DONE && !resource.encryption_blob_encrypted;
if (!resource) return 'notFound';
if (ls.fetch_status !== Resource.FETCH_STATUS_DONE) return 'notDownloaded';
if (resource.encryption_blob_encrypted) return 'encrypted';
return 'ok';
}
// For resources, we need to decrypt the item (metadata) and the resource binary blob.