diff --git a/chrome/content/zotero/xpcom/data/items.js b/chrome/content/zotero/xpcom/data/items.js index abc500e8a4..62ed5905c9 100644 --- a/chrome/content/zotero/xpcom/data/items.js +++ b/chrome/content/zotero/xpcom/data/items.js @@ -460,6 +460,9 @@ Zotero.Items = new function() { item.save(); + // Hack to remove master item from duplicates view without recalculating duplicates + Zotero.Notifier.trigger('removeDuplicatesMaster', 'item', item.id); + Zotero.DB.commitTransaction(); } diff --git a/chrome/content/zotero/xpcom/duplicates.js b/chrome/content/zotero/xpcom/duplicates.js index 6a990a63a7..13c67ba942 100644 --- a/chrome/content/zotero/xpcom/duplicates.js +++ b/chrome/content/zotero/xpcom/duplicates.js @@ -101,6 +101,8 @@ Zotero.Duplicates.prototype._getObjectFromID = function (id) { Zotero.Duplicates.prototype._findDuplicates = function () { + Zotero.debug("Finding duplicates"); + var start = Date.now(); var self = this; diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index 08d67df308..5952df6f77 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -551,58 +551,48 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData) this._treebox.beginUpdateBatch(); if ((action == 'remove' && !itemGroup.isLibrary(true)) - || action == 'delete' || action == 'trash') { - - // On a delete in duplicates mode, just refresh rather than figuring - // out what to remove - if (itemGroup.isDuplicates()) { - previousRow = this._itemRowMap[ids[0]]; - this.refresh(); - madeChanges = true; - sort = true; + || action == 'delete' || action == 'trash' + || (action == 'removeDuplicatesMaster' && itemGroup.isDuplicates())) { + // Since a remove involves shifting of rows, we have to do it in order, + // so sort the ids by row + var rows = []; + for (var i=0, len=ids.length; i 0) { + rows.push(row); + } + } + } } - else { - // Since a remove involves shifting of rows, we have to do it in order, - // so sort the ids by row - var rows = []; - for (var i=0, len=ids.length; i 0) { - rows.push(row); - } - } + + if (rows.length > 0) { + rows.sort(function(a,b) { return a-b }); + + for(var i=0, len=rows.length; i 0) { - rows.sort(function(a,b) { return a-b }); - - for(var i=0, len=rows.length; i