commit f9aa9383cbaadd197cf6fdbc6313904d1977d48f
parent 31bf663b03d43d0e6311c846ac4a444dddef0d12
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 5 Jul 2009 10:48:19 +0000
- Automatically run a full sync when triggered by server, which should allow for auto-correction of a wide range of remaining sync errors (though not all cause server to trigger full sync yet)
- Display exclamation mark on sync icon if a background sync fails due to a conflict (which requires manual intervention)
Diffstat:
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -859,8 +859,7 @@ Zotero.Sync.Server = new function () {
var response = xmlhttp.responseXML.childNodes[0];
if (response.firstChild.tagName == 'error') {
- if (response.firstChild.getAttribute('type') == 'forbidden'
- && response.firstChild.getAttribute('code') == 'INVALID_LOGIN') {
+ if (response.firstChild.getAttribute('code') == 'INVALID_LOGIN') {
_error('Invalid login/pass');
}
_error(response.firstChild.firstChild.nodeValue);
@@ -1498,16 +1497,14 @@ Zotero.Sync.Server = new function () {
}
break;
- case 'ITEM_MISSING':
- var [libraryID, key] = firstChild.getAttribute('missingItem').split('/');
- if (libraryID == Zotero.libraryID) {
- libraryID = null;
- }
- var item = Zotero.Items.getByLibraryAndKey(libraryID, key);
- if (item) {
- Zotero.DB.rollbackAllTransactions();
- item.updateClientDateModified();
- }
+ case 'FULL_SYNC_REQUIRED':
+ Zotero.DB.rollbackAllTransactions();
+ // Let current sync fail, and then do a full sync
+ var background = Zotero.Sync.Runner.background;
+ setTimeout(function () {
+ Zotero.Sync.Server.resetClient();
+ Zotero.Sync.Runner.sync(background);
+ }, 1);
break;
case 'TAG_TOO_LONG':
@@ -2254,9 +2251,8 @@ Zotero.Sync.Server.Data = new function() {
//
if (toReconcile.length) {
if (Zotero.Sync.Runner.background) {
- Zotero.debug("Background sync resulted in conflict -- aborting");
- Zotero.DB.rollbackTransaction();
- return false;
+ // TODO: localize
+ throw ("Background sync resulted in conflict \u2014 manual sync required");
}
var mergeData = _reconcile(type, toReconcile, remoteCreatorStore);