Trigger full reset on missing collection parent

This commit is contained in:
Dan Stillman 2009-07-11 01:17:01 +00:00
parent 0ac95bfacd
commit 28bbce4bf5

View file

@ -3221,6 +3221,7 @@ Zotero.Sync.Server.Data = new function() {
* Recursively save collections from the top down
*/
function _saveCollections(collections) {
var originalLength = collections.length;
var unsaved = [];
var parentKey, parentCollection;
@ -3246,6 +3247,12 @@ Zotero.Sync.Server.Data = new function() {
continue;
}
if (unsaved.length == originalLength) {
var msg = "Incomplete collection hierarchy cannot be saved in Zotero.Sync.Server.Data._saveCollections()";
var e = new Zotero.Error(msg, "MISSING_OBJECT");
throw (e);
}
if (unsaved.length) {
_saveCollections(unsaved);
}