mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
All: Fixes #85: Don't record deleted_items entries for folders deleted via sync
This commit is contained in:
parent
d1f1d1068a
commit
961b5bfd25
@ -268,6 +268,24 @@ describe('Synchronizer', function() {
|
||||
expect(deletedItems.length).toBe(0);
|
||||
}));
|
||||
|
||||
it('should not created deleted_items entries for items deleted via sync', asyncTest(async () => {
|
||||
let folder1 = await Folder.save({ title: "folder1" });
|
||||
let note1 = await Note.save({ title: "un", parent_id: folder1.id });
|
||||
await synchronizer().start();
|
||||
|
||||
await switchClient(2);
|
||||
|
||||
await synchronizer().start();
|
||||
await Folder.delete(folder1.id);
|
||||
await synchronizer().start();
|
||||
|
||||
await switchClient(1);
|
||||
|
||||
await synchronizer().start();
|
||||
let deletedItems = await BaseItem.deletedItems(syncTargetId());
|
||||
expect(deletedItems.length).toBe(0);
|
||||
}));
|
||||
|
||||
it('should delete local notes', asyncTest(async () => {
|
||||
let folder1 = await Folder.save({ title: "folder1" });
|
||||
let note1 = await Note.save({ title: "un", parent_id: folder1.id });
|
||||
|
@ -174,6 +174,15 @@ class BaseItem extends BaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Currently, one a deleted_items entry has been processed, it is removed from the database. In practice it means that
|
||||
// the following case will not work as expected:
|
||||
// - Client 1 creates a note and sync with target 1 and 2
|
||||
// - Client 2 sync with target 1
|
||||
// - Client 2 deletes note and sync with target 1
|
||||
// - Client 1 syncs with target 1 only (note is deleted from local machine, as expected)
|
||||
// - Client 1 syncs with target 2 only => the note is *not* deleted from target 2 because no information
|
||||
// that it was previously deleted exist (deleted_items entry has been deleted).
|
||||
// The solution would be to permanently store the list of deleted items on each client.
|
||||
static deletedItems(syncTarget) {
|
||||
return this.db().selectAll('SELECT * FROM deleted_items WHERE sync_target = ?', [syncTarget]);
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ class Synchronizer {
|
||||
if (noteIds.length) { // CONFLICT
|
||||
await Folder.markNotesAsConflict(item.id);
|
||||
}
|
||||
await Folder.delete(item.id, { deleteChildren: false });
|
||||
await Folder.delete(item.id, { deleteChildren: false, trackDeleted: false });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user