If a tag is deleted remotely and modified locally, keep local and display warning
This commit is contained in:
parent
b3cca1f60e
commit
1d972ae92c
2 changed files with 35 additions and 13 deletions
|
@ -51,11 +51,8 @@ var Zotero_Merge_Window = new function () {
|
|||
}
|
||||
break;
|
||||
|
||||
case 'collection':
|
||||
break;
|
||||
|
||||
default:
|
||||
throw ("Unsupported merge object type '" + type
|
||||
throw ("Unsupported merge object type '" + _mergeGroup.type
|
||||
+ "' in Zotero_Merge_Window.init()");
|
||||
}
|
||||
|
||||
|
|
|
@ -1752,7 +1752,7 @@ Zotero.Sync.Server.Data = new function() {
|
|||
|
||||
default:
|
||||
alert('Delete reconciliation unimplemented for ' + types);
|
||||
throw ('Delete reconciliation unimplemented for ' + types);
|
||||
throw ('Delete reconciliation unimplemented for ' + types);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1852,7 +1852,7 @@ Zotero.Sync.Server.Data = new function() {
|
|||
|
||||
|
||||
//
|
||||
// Handle deleted objects
|
||||
// Handle remotely deleted objects
|
||||
//
|
||||
if (xml.deleted && xml.deleted[types]) {
|
||||
Zotero.debug("Processing remotely deleted " + types);
|
||||
|
@ -1869,19 +1869,37 @@ Zotero.Sync.Server.Data = new function() {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Local object has been modified since last sync -- reconcile
|
||||
var now = Zotero.Date.sqlToDate(obj.dateModified, true);
|
||||
if (now >= lastLocalSyncDate) {
|
||||
// TODO: order reconcile by parent/child
|
||||
toReconcile.push([obj, 'deleted']);
|
||||
}
|
||||
var modDate = Zotero.Date.sqlToDate(obj.dateModified, true);
|
||||
|
||||
// Local object hasn't been modified -- delete
|
||||
else {
|
||||
if (modDate < lastLocalSyncDate) {
|
||||
toDelete.push(obj.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Local object has been modified since last sync -- reconcile
|
||||
switch (type) {
|
||||
case 'item':
|
||||
// TODO: order reconcile by parent/child
|
||||
toReconcile.push([obj, 'deleted']);
|
||||
break;
|
||||
|
||||
case 'tag':
|
||||
var msg = _generateAutoChangeMessage(
|
||||
type, obj.name, null
|
||||
);
|
||||
alert(msg);
|
||||
continue;
|
||||
|
||||
default:
|
||||
alert('Delete reconciliation unimplemented for ' + types);
|
||||
throw ('Delete reconciliation unimplemented for ' + types);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Reconcile objects that have changed locally and remotely
|
||||
//
|
||||
|
@ -2246,6 +2264,10 @@ Zotero.Sync.Server.Data = new function() {
|
|||
localName = "[deleted]";
|
||||
var localDelete = true;
|
||||
}
|
||||
else if (remoteName === null) {
|
||||
remoteName = "[deleted]";
|
||||
var remoteDelete = true;
|
||||
}
|
||||
|
||||
// TODO: localize
|
||||
var msg = "A " + itemType + " has changed both locally and "
|
||||
|
@ -2257,6 +2279,9 @@ Zotero.Sync.Server.Data = new function() {
|
|||
if (localDelete) {
|
||||
msg += "The remote version has been kept.";
|
||||
}
|
||||
else if (remoteDelete) {
|
||||
msg += "The local version has been kept.";
|
||||
}
|
||||
else {
|
||||
var moreRecent = remoteMoreRecent ? remoteName : localName;
|
||||
msg += "The most recent version, '" + moreRecent + "', has been kept.";
|
||||
|
|
Loading…
Reference in a new issue