From 84244330b7a95de5733986753c5e6433749a3a8a Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 24 Mar 2017 14:08:55 +0000 Subject: [PATCH] Always log deletes, even when not previously added to server. Before this change we would only add "deletes" to the server when the resource has been previously uploaded. This means that if a resource has been created and then deleted before a sync, it would not be saved, which is essentially data-loss. This commit fixes it, so we always upload a delete entry. --- .../etesync/syncadapter/syncadapter/SyncManager.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.java b/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.java index df6f6fb2..8a8da1e7 100644 --- a/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.java +++ b/app/src/main/java/com/etesync/syncadapter/syncadapter/SyncManager.java @@ -268,7 +268,7 @@ abstract public class SyncManager { // If we are updating an existing installation with no saved journal, we need to add remoteEntries = journal.getEntries(settings.password(), null); int i = 0; - for (JournalEntryManager.Entry entry : remoteEntries){ + for (JournalEntryManager.Entry entry : remoteEntries) { SyncEntry cEntry = SyncEntry.fromJournalEntry(settings.password(), entry); persistSyncEntry(entry.getUuid(), cEntry); i++; @@ -404,13 +404,8 @@ abstract public class SyncManager { if (Thread.interrupted()) return ret; - if (!local.isLocalOnly()) { - App.log.info(local.getUuid() + " has been deleted locally -> deleting from server"); - ret.add(local); - } else { - App.log.info("Removing local record #" + local.getId() + " which has been deleted locally and was never uploaded"); - local.delete(); - } + App.log.info(local.getUuid() + " has been deleted locally -> deleting from server"); + ret.add(local); syncResult.stats.numDeletes++; }