1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +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

@ -718,9 +718,9 @@ class Synchronizer {
if (action == 'createLocal') options.isNew = true;
if (action == 'updateLocal') options.oldItem = local;
const creatingNewResource = content.type_ == BaseModel.TYPE_RESOURCE && action == 'createLocal';
const creatingOrUpdatingResource = content.type_ == BaseModel.TYPE_RESOURCE && (action == 'createLocal' || action == 'updateLocal');
if (creatingNewResource) {
if (creatingOrUpdatingResource) {
if (content.size >= this.maxResourceSize()) {
await handleCannotSyncItem(ItemClass, syncTargetId, content, `File "${content.title}" is larger than allowed ${this.maxResourceSize()} bytes. Beyond this limit, the mobile app would crash.`, BaseItem.SYNC_ITEM_LOCATION_REMOTE);
continue;
@ -731,7 +731,7 @@ class Synchronizer {
await ItemClass.save(content, options);
if (creatingNewResource) this.dispatch({ type: 'SYNC_CREATED_RESOURCE', id: content.id });
if (creatingOrUpdatingResource) this.dispatch({ type: 'SYNC_CREATED_OR_UPDATED_RESOURCE', id: content.id });
if (!hasAutoEnabledEncryption && content.type_ === BaseModel.TYPE_MASTER_KEY && !masterKeysBefore) {
hasAutoEnabledEncryption = true;