commit f482f65a4627e3955856b480c2df8bd1fe161655
parent 9665d14a18af9e59367bfd502a92f49e80eb12d8
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 28 Sep 2009 06:39:54 +0000
- Fix some causes of "Source item for keyed source doesn't exist"
- If a child item is in conflict, always keep parent item if one side has one regardless of which side is chosen
- On cancelling sync from CR window, don't continue with file sync
- Clarify "Background sync resulted in conflict" message
- Display the error icon rather than the warning icon on errors (though some file sync problems should be changed to warnings instead)
Diffstat:
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -1979,7 +1979,7 @@ Zotero.Item.prototype.isRegularItem = function() {
Zotero.Item.prototype.isTopLevelItem = function () {
- return this.isRegularItem() || !this.getSource();
+ return this.isRegularItem() || !this.getSourceKey();
}
@@ -3689,9 +3689,9 @@ Zotero.Item.prototype.clone = function(includePrimary, newItem, unsaved) {
else {
newItem.setNote(this.getNote());
if (sameLibrary) {
- var parent = this.getSource();
+ var parent = this.getSourceKey();
if (parent) {
- newItem.setSource(parent);
+ newItem.setSourceKey(parent);
}
}
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -749,6 +749,7 @@ Zotero.Sync.Runner = new function () {
icon.setAttribute('status', '');
warning.hidden = false;
warning.setAttribute('mode', status);
+ warning.setAttribute('error', status == 'error');
warning.tooltipText = "A sync error occurred. Click to view details.";
warning.onclick = function () {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
@@ -1267,7 +1268,7 @@ Zotero.Sync.Server = new function () {
Zotero.debug("Sync cancelled");
Zotero.DB.rollbackTransaction();
Zotero.Sync.Server.unlock(function () {
- _callbacks.onSkip();
+ _callbacks.onStop();
});
Zotero.reloadDataObjects();
Zotero.Sync.EventListener.resetIgnored();
@@ -1749,7 +1750,7 @@ Zotero.Sync.Server = new function () {
return;
}
if (!Zotero.Sync.Server.canAutoResetClient) {
- Components.utils.reportError("Client has already been auto-reset in Zotero.Sync.Server._checkResponse() -- manual sync required");
+ Components.utils.reportError("Client has already been auto-reset in Zotero.Sync.Server._checkResponse()");
return;
}
@@ -2403,6 +2404,7 @@ Zotero.Sync.Server.Data = new function() {
case 'item':
var diff = obj.diff(remoteObj, false, ["dateModified"]);
+ Zotero.debug(diff);
if (!diff) {
// Check if creators changed
var creatorsChanged = false;
@@ -2431,6 +2433,17 @@ Zotero.Sync.Server.Data = new function() {
}
}
+ // Always keep the parent item if there is one,
+ // regardless of which side is chosen during CR
+ var localParent = obj.getSourceKey();
+ var remoteParent = remoteObj.getSourceKey();
+ if (!localParent && remoteParent) {
+ obj.setSourceKey(remoteParent);
+ }
+ else if (localParent && !remoteParent) {
+ remoteObj.setSourceKey(localParent);
+ }
+
/*
if (obj.deleted && !remoteObj.deleted) {
obj = 'trashed';
@@ -2659,13 +2672,13 @@ Zotero.Sync.Server.Data = new function() {
if (toReconcile.length) {
if (Zotero.Sync.Runner.background) {
// TODO: localize
- throw ("Background sync resulted in conflict \u2014 manual sync required");
+ throw ("An automatic sync resulted in a conflict that requires manual intervention.\n\nClick the sync icon to sync manually.");
}
var mergeData = _reconcile(type, toReconcile, remoteCreatorStore);
if (!mergeData) {
Zotero.DB.rollbackTransaction();
- throw ("Merge error");
+ return false;
}
_processMergeData(
syncSession,
diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css
@@ -221,6 +221,7 @@
#zotero-tb-sync-warning[error=true]
{
list-style-image: url(chrome://zotero/skin/exclamation.png);
+ margin-bottom: 2px;
}
#zotero-tb-sync {