This commit is contained in:
Dan Stillman 2016-12-01 16:01:06 -05:00
parent 9541a6cfcd
commit 8c48b2f806

View file

@ -816,10 +816,12 @@ Zotero.Sync.Data.Engine.prototype._startUpload = Zotero.Promise.coroutine(functi
// New/modified objects
let ids = yield Zotero.Sync.Data.Local.getUnsynced(objectType, this.libraryID);
let origIDs = ids; // TEMP
// Skip objects in sync queue, because they might have unresolved conflicts.
// The queue only has keys, so we have to convert to keys and back.
let unsyncedKeys = ids.map(id => objectsClass.getLibraryAndKeyFromID(id).key);
let origUnsynced = unsyncedKeys; // TEMP
let queueKeys = yield Zotero.Sync.Data.Local.getObjectsFromSyncQueue(objectType, this.libraryID);
unsyncedKeys = Zotero.Utilities.arrayDiff(unsyncedKeys, queueKeys);
// TEMP
@ -828,12 +830,18 @@ Zotero.Sync.Data.Engine.prototype._startUpload = Zotero.Promise.coroutine(functi
ids = unsyncedKeys.map(key => {
let id = objectsClass.getIDFromLibraryAndKey(this.libraryID, key)
if (!id) {
Zotero.debug("Missing id for key " + key);
missing.push(key);
}
return id;
});
if (missing.length) {
Zotero.debug("Missing " + objectTypePlural + ":");
Zotero.debug(origIDs);
Zotero.debug(origUnsynced);
Zotero.debug(ids);
Zotero.debug(unsyncedKeys);
Zotero.debug(missing);
for (let key of missing) {
Zotero.debug(yield Zotero.DB.valueQueryAsync(
`SELECT ${objectsClass.idColumn} FROM ${objectsClass.table} WHERE libraryID=? AND key=?`,