- 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)
This commit is contained in:
Dan Stillman 2009-09-28 06:39:54 +00:00
parent 9665d14a18
commit f482f65a46
3 changed files with 21 additions and 7 deletions

View file

@ -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);
}
}

View file

@ -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,

View file

@ -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 {