www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit bb3496dfa8c6a159e92ad6493aee9abd4b563c31
parent 828f3f5024457d4af63328a6050f1968e8649224
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue, 17 Mar 2015 01:08:18 -0400

Fix item duplication

Diffstat:
Mchrome/content/zotero/xpcom/data/item.js | 1+
Mchrome/content/zotero/zoteroPane.js | 13+++----------
2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -3737,6 +3737,7 @@ Zotero.Item.prototype.multiDiff = Zotero.Promise.coroutine(function* (otherItems * * @param {Number} [libraryID] - libraryID of the new item, or the same as original if omitted * @param {Boolean} [skipTags=false] - Skip tags + * @return {Promise<Zotero.Item>} */ Zotero.Item.prototype.clone = Zotero.Promise.coroutine(function* (libraryID, skipTags) { Zotero.debug('Cloning item ' + this.id); diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js @@ -1548,19 +1548,12 @@ var ZoteroPane = new function() var item = self.getSelectedItems()[0]; var newItem; - yield Zotero.DB.executeTransaction(function () { - // Create new unsaved clone item in target library - newItem = new Zotero.Item(item.itemTypeID); - newItem.libraryID = item.libraryID; - // DEBUG: save here because clone() doesn't currently work on unsaved tagged items - var id = yield newItem.save(); - - var newItem = yield Zotero.Items.getAsync(id); - yield item.clone(false, newItem, false, !Zotero.Prefs.get('groups.copyTags')); + yield Zotero.DB.executeTransaction(function* () { + newItem = yield item.clone(null, !Zotero.Prefs.get('groups.copyTags')); yield newItem.save(); if (self.collectionsView.selectedTreeRow.isCollection() && newItem.isTopLevelItem()) { - self.collectionsView.selectedTreeRow.ref.addItem(newItem.id); + yield self.collectionsView.selectedTreeRow.ref.addItem(newItem.id); } });