www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit a9dbe02ef9e87cb367d1f0aa098994c842a18f91
parent 66a5b1ab14ee2826df008e6e6d72458d4afb1365
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue, 17 May 2011 20:53:38 +0000

- Don't set the last local sync time after a download if an upload fails to avoid reuploading of downloaded data
- If no local sync time set (because an initial upload never went through), ignore remote sync time and repull all data so downloaded items aren't reuploaded


Diffstat:
Mchrome/content/zotero/xpcom/sync.js | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js @@ -1333,6 +1333,16 @@ Zotero.Sync.Server = new function () { if (!lastsync) { lastsync = 1; } + + // If no local timestamp is stored, don't use remote time + // + // This used to be possible when remote time was saved whether or not + // the subsequent upload went through + var lastLocalSyncTime = Zotero.Sync.Server.lastLocalSyncTime; + if (!lastLocalSyncTime) { + lastsync = 1; + } + var body = _apiVersionComponent + '&' + Zotero.Sync.Server.sessionIDComponent + '&lastsync=' + lastsync; @@ -1407,7 +1417,6 @@ Zotero.Sync.Server = new function () { Zotero.UnresponsiveScriptIndicator.disable(); - var lastLocalSyncTime = Zotero.Sync.Server.lastLocalSyncTime; var lastLocalSyncDate = lastLocalSyncTime ? new Date(lastLocalSyncTime * 1000) : false; @@ -1465,10 +1474,9 @@ Zotero.Sync.Server = new function () { Zotero.debug(xmlstr); } - Zotero.Sync.Server.lastRemoteSyncTime = response.getAttribute('timestamp'); - if (!xmlstr) { Zotero.debug("Nothing to upload to server"); + Zotero.Sync.Server.lastRemoteSyncTime = response.getAttribute('timestamp'); Zotero.Sync.Server.lastLocalSyncTime = nextLocalSyncTime; Zotero.Sync.Server.nextLocalSyncDate = false; Zotero.DB.commitTransaction();