1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-13 22:12:50 +02:00
This commit is contained in:
Laurent Cozic
2017-06-18 00:53:19 +01:00
parent 2e8a56ad5e
commit 5748170bd9

View File

@@ -163,11 +163,11 @@ class Synchronizer {
if (local.syncTime) { if (local.syncTime) {
action.type = 'delete'; action.type = 'delete';
action.dest = 'local'; action.dest = 'local';
action.reason = 'Local item has been synced to remote previously, but remote no longer exist, which means it has been deleted'; action.reason = 'Local has been synced to remote previously, but remote no longer exist, which means remote has been deleted';
} else { } else {
action.type = 'create'; action.type = 'create';
action.dest = 'remote'; action.dest = 'remote';
action.reason = 'Local item has never been synced to remote, and remote does not exists, which means it is new'; action.reason = 'Local has never been synced to remote, and remote does not exists, which means remote must be created';
} }
} else { } else {
if (this.itemIsStrictlyOlderThan(local, local.syncTime)) continue; if (this.itemIsStrictlyOlderThan(local, local.syncTime)) continue;
@@ -178,7 +178,7 @@ class Synchronizer {
action.reason = sprintf('Remote (%s) was modified after last sync of local (%s).', moment.unix(remote.updatedTime).toISOString(), moment.unix(local.syncTime).toISOString(),); action.reason = sprintf('Remote (%s) was modified after last sync of local (%s).', moment.unix(remote.updatedTime).toISOString(), moment.unix(local.syncTime).toISOString(),);
} else if (this.itemIsStrictlyNewerThan(remote, local.syncTime)) { } else if (this.itemIsStrictlyNewerThan(remote, local.syncTime)) {
action.type = 'conflict'; action.type = 'conflict';
action.reason = sprintf('Both remote (%s) and local items (%s) were modified after the last sync (%s).', action.reason = sprintf('Both remote (%s) and local (%s) were modified after the last sync (%s).',
moment.unix(remote.updatedTime).toISOString(), moment.unix(remote.updatedTime).toISOString(),
moment.unix(local.updatedTime).toISOString(), moment.unix(local.updatedTime).toISOString(),
moment.unix(local.syncTime).toISOString() moment.unix(local.syncTime).toISOString()
@@ -230,12 +230,12 @@ class Synchronizer {
// modified since the last sync, it's been processed in the previous loop. // modified since the last sync, it's been processed in the previous loop.
// So throw an exception is this normally impossible condition happens anyway. // So throw an exception is this normally impossible condition happens anyway.
// It's handled at condition this.itemIsStrictlyNewerThan(remote, local.syncTime) in above loop // It's handled at condition this.itemIsStrictlyNewerThan(remote, local.syncTime) in above loop
if (this.itemIsStrictlyNewerThan(remote, local.syncTime)) throw new Error('Remote item cannot be newer than last sync time.'); if (this.itemIsStrictlyNewerThan(remote, local.syncTime)) throw new Error('Remote cannot be newer than last sync time.');
if (this.itemIsStrictlyNewerThan(remote, local.updatedTime)) { if (this.itemIsStrictlyNewerThan(remote, local.updatedTime)) {
action.type = 'update'; action.type = 'update';
action.dest = 'local'; action.dest = 'local';
action.reason = sprintf('Remote (%s) was modified after last sync of local (%s).', moment.unix(remote.updatedTime).toISOString(), moment.unix(local.syncTime).toISOString(),);; action.reason = sprintf('Remote (%s) was modified after local (%s).', moment.unix(remote.updatedTime).toISOString(), moment.unix(local.updatedTime).toISOString(),);;
} else { } else {
continue; continue;
} }