- 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)
This commit is contained in:
Dan Stillman 2009-07-05 10:48:19 +00:00
parent 31bf663b03
commit f9aa9383cb

View File

@ -859,8 +859,7 @@ Zotero.Sync.Server = new function () {
var response = xmlhttp.responseXML.childNodes[0]; var response = xmlhttp.responseXML.childNodes[0];
if (response.firstChild.tagName == 'error') { if (response.firstChild.tagName == 'error') {
if (response.firstChild.getAttribute('type') == 'forbidden' if (response.firstChild.getAttribute('code') == 'INVALID_LOGIN') {
&& response.firstChild.getAttribute('code') == 'INVALID_LOGIN') {
_error('Invalid login/pass'); _error('Invalid login/pass');
} }
_error(response.firstChild.firstChild.nodeValue); _error(response.firstChild.firstChild.nodeValue);
@ -1498,16 +1497,14 @@ Zotero.Sync.Server = new function () {
} }
break; break;
case 'ITEM_MISSING': case 'FULL_SYNC_REQUIRED':
var [libraryID, key] = firstChild.getAttribute('missingItem').split('/'); Zotero.DB.rollbackAllTransactions();
if (libraryID == Zotero.libraryID) { // Let current sync fail, and then do a full sync
libraryID = null; var background = Zotero.Sync.Runner.background;
} setTimeout(function () {
var item = Zotero.Items.getByLibraryAndKey(libraryID, key); Zotero.Sync.Server.resetClient();
if (item) { Zotero.Sync.Runner.sync(background);
Zotero.DB.rollbackAllTransactions(); }, 1);
item.updateClientDateModified();
}
break; break;
case 'TAG_TOO_LONG': case 'TAG_TOO_LONG':
@ -2254,9 +2251,8 @@ Zotero.Sync.Server.Data = new function() {
// //
if (toReconcile.length) { if (toReconcile.length) {
if (Zotero.Sync.Runner.background) { if (Zotero.Sync.Runner.background) {
Zotero.debug("Background sync resulted in conflict -- aborting"); // TODO: localize
Zotero.DB.rollbackTransaction(); throw ("Background sync resulted in conflict \u2014 manual sync required");
return false;
} }
var mergeData = _reconcile(type, toReconcile, remoteCreatorStore); var mergeData = _reconcile(type, toReconcile, remoteCreatorStore);