From 9e9f8db1df7f9adffb5a5b22c52a79dccb2d0340 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 6 Jul 2009 11:27:44 +0000 Subject: [PATCH] - Fix sync error when a file of an attachment with tags was in conflict - Missed file from previous commit --- chrome/content/zotero/overlay.xul | 2 +- chrome/content/zotero/xpcom/data/item.js | 9 +++++++-- chrome/content/zotero/xpcom/storage.js | 5 +++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul index 76fd87fcc..ff8900f81 100644 --- a/chrome/content/zotero/overlay.xul +++ b/chrome/content/zotero/overlay.xul @@ -354,7 +354,7 @@ + oncommand="Zotero.Sync.Server.canAutoResetClient = true; Zotero.Sync.Runner.sync()"> diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 6193d67c0..7a92c8611 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -3379,8 +3379,13 @@ Zotero.Item.prototype.diff = function (item, includeMatches, ignoreFields) { /** * Returns an unsaved copy of the item + * + * @param {Boolean} [includePrimary=false] + * @param {Zotero.Item} [newItem=null] Target item for clone (used to pass a saved + * item for duplicating items with tags) + * @param {Boolean} [unsaved=false] Skip properties that require a saved object (e.g., tags) */ -Zotero.Item.prototype.clone = function(includePrimary, newItem) { +Zotero.Item.prototype.clone = function(includePrimary, newItem, unsaved) { Zotero.debug('Cloning item ' + this.id); if (includePrimary && newItem) { @@ -3521,7 +3526,7 @@ Zotero.Item.prototype.clone = function(includePrimary, newItem) { } } - if (obj.tags) { + if (!unsaved && obj.tags) { for each(var tag in obj.tags) { if (sameLibrary) { newItem.addTagByID(tag.primary.tagID); diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js index 4cb96e050..6bb023123 100644 --- a/chrome/content/zotero/xpcom/storage.js +++ b/chrome/content/zotero/xpcom/storage.js @@ -2375,10 +2375,10 @@ Zotero.Sync.Storage.QueueManager = new function () { var objectPairs = []; for each(var conflict in _conflicts) { var item = Zotero.Items.getByLibraryAndKey(null, conflict.name); - var item1 = item.clone(); + var item1 = item.clone(false, false, true); item1.setField('dateModified', Zotero.Date.dateToSQL(new Date(conflict.localData.modTime * 1000), true)); - var item2 = item.clone(); + var item2 = item.clone(false, false, true); item2.setField('dateModified', Zotero.Date.dateToSQL(new Date(conflict.remoteData.modTime * 1000), true)); objectPairs.push([item1, item2]); @@ -2480,6 +2480,7 @@ Zotero.Sync.Storage.Queue = function (name) { Zotero.debug(this.Name + " queue is done"); // DEBUG info Zotero.debug("Active requests: " + this.activeRequests); + Zotero.debug("Errors:"); Zotero.debug(this._errors); if (this.activeRequests) {