1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-13 22:12:50 +02:00

All: Fixed fetch logic - mark resource as fetched by default, unless it comes from sync

This commit is contained in:
Laurent Cozic
2018-10-10 18:53:09 +01:00
parent 58d748e235
commit 8bac5275c3
2 changed files with 6 additions and 4 deletions

View File

@@ -397,7 +397,7 @@ class JoplinDatabase extends Database {
}
if (targetVersion == 13) {
queries.push('ALTER TABLE resources ADD COLUMN fetch_status INT NOT NULL DEFAULT "0"');
queries.push('ALTER TABLE resources ADD COLUMN fetch_status INT NOT NULL DEFAULT "2"');
queries.push('ALTER TABLE resources ADD COLUMN fetch_error TEXT NOT NULL DEFAULT ""');
queries.push({ sql: 'UPDATE resources SET fetch_status = ?', params: [Resource.FETCH_STATUS_DONE] });
}

View File

@@ -555,6 +555,8 @@ class Synchronizer {
if (action == "createLocal") options.isNew = true;
if (action == "updateLocal") options.oldItem = local;
const creatingNewResource = content.type_ == BaseModel.TYPE_RESOURCE && action == "createLocal";
// if (content.type_ == BaseModel.TYPE_RESOURCE && action == "createLocal") {
// let localResourceContentPath = Resource.fullPath(content);
// let remoteResourceContentPath = this.resourceDirName_ + "/" + content.id;
@@ -571,11 +573,11 @@ class Synchronizer {
// }
// }
if (creatingNewResource) content.fetch_status = Resource.FETCH_STATUS_IDLE;
await ItemClass.save(content, options);
if (content.type_ == BaseModel.TYPE_RESOURCE && action == "createLocal") {
this.dispatch({ type: "SYNC_CREATED_RESOURCE", id: content.id });
}
if (creatingNewResource) this.dispatch({ type: "SYNC_CREATED_RESOURCE", id: content.id });
if (!hasAutoEnabledEncryption && content.type_ === BaseModel.TYPE_MASTER_KEY && !masterKeysBefore) {
hasAutoEnabledEncryption = true;