Remove merged items from duplicates view without regenerating list

This commit is contained in:
Dan Stillman 2016-04-24 19:58:44 -04:00
parent 7cf0ff2683
commit bee32d1a51
3 changed files with 43 additions and 48 deletions

View file

@ -460,6 +460,9 @@ Zotero.Items = new function() {
item.save(); item.save();
// Hack to remove master item from duplicates view without recalculating duplicates
Zotero.Notifier.trigger('removeDuplicatesMaster', 'item', item.id);
Zotero.DB.commitTransaction(); Zotero.DB.commitTransaction();
} }

View file

@ -101,6 +101,8 @@ Zotero.Duplicates.prototype._getObjectFromID = function (id) {
Zotero.Duplicates.prototype._findDuplicates = function () { Zotero.Duplicates.prototype._findDuplicates = function () {
Zotero.debug("Finding duplicates");
var start = Date.now(); var start = Date.now();
var self = this; var self = this;

View file

@ -551,22 +551,13 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
this._treebox.beginUpdateBatch(); this._treebox.beginUpdateBatch();
if ((action == 'remove' && !itemGroup.isLibrary(true)) if ((action == 'remove' && !itemGroup.isLibrary(true))
|| action == 'delete' || action == 'trash') { || action == 'delete' || action == 'trash'
|| (action == 'removeDuplicatesMaster' && itemGroup.isDuplicates())) {
// 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;
}
else {
// Since a remove involves shifting of rows, we have to do it in order, // Since a remove involves shifting of rows, we have to do it in order,
// so sort the ids by row // so sort the ids by row
var rows = []; var rows = [];
for (var i=0, len=ids.length; i<len; i++) { for (var i=0, len=ids.length; i<len; i++) {
if (action == 'delete' || action == 'trash' || if (action == 'delete' || action == 'trash' || action == 'removeDuplicatesMaster' ||
!itemGroup.ref.hasItem(ids[i])) { !itemGroup.ref.hasItem(ids[i])) {
let row = this._itemRowMap[ids[i]]; let row = this._itemRowMap[ids[i]];
@ -604,7 +595,6 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData)
sort = true; sort = true;
} }
} }
}
else if (action == 'modify') else if (action == 'modify')
{ {
// If trash or saved search, just re-run search // If trash or saved search, just re-run search