Don't show deleted items outside of trash
This commit is contained in:
parent
3692536770
commit
6b8e5bafc6
|
@ -3083,6 +3083,7 @@ Zotero.ItemTreeView.prototype.drop = Zotero.Promise.coroutine(function* (row, or
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Zotero.ItemTreeView.prototype.isSeparator = function(row) { return false; }
|
||||
Zotero.ItemTreeView.prototype.isSelectable = function (row, col) { return true; }
|
||||
Zotero.ItemTreeView.prototype.getRowProperties = function(row, prop) {}
|
||||
Zotero.ItemTreeView.prototype.getColumnProperties = function(col, prop) {}
|
||||
Zotero.ItemTreeView.prototype.getCellProperties = function(row, col, prop) {
|
||||
|
|
|
@ -82,9 +82,11 @@ Zotero.LibraryTreeView.prototype = {
|
|||
* @return {Integer}
|
||||
*/
|
||||
getRowIndexByID: function (id) {
|
||||
// FIXME: Should work for itemIDs too
|
||||
var type = id[0];
|
||||
id = ('' + id).substr(1);
|
||||
var type = "";
|
||||
if (this.type != 'item') {
|
||||
var type = id[0];
|
||||
id = ('' + id).substr(1);
|
||||
}
|
||||
return this._rowMap[type + id];
|
||||
},
|
||||
|
||||
|
|
|
@ -1051,12 +1051,14 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () {
|
|||
}
|
||||
|
||||
// Exclude deleted items (and their child items) by default
|
||||
let not = deleted ? "" : "NOT ";
|
||||
let op = deleted ? "OR" : "AND";
|
||||
sql += " WHERE ("
|
||||
+ "itemID " + (deleted ? "" : "NOT ") + "IN (SELECT itemID FROM deletedItems) "
|
||||
+ "OR itemID " + (deleted ? "" : "NOT ") + "IN (SELECT itemID FROM itemNotes "
|
||||
+ `itemID ${not} IN (SELECT itemID FROM deletedItems) `
|
||||
+ `${op} itemID ${not}IN (SELECT itemID FROM itemNotes `
|
||||
+ "WHERE parentItemID IS NOT NULL AND "
|
||||
+ "parentItemID IN (SELECT itemID FROM deletedItems)) "
|
||||
+ "OR itemID " + (deleted ? "" : "NOT ") + "IN (SELECT itemID FROM itemAttachments "
|
||||
+ `${op} itemID ${not}IN (SELECT itemID FROM itemAttachments `
|
||||
+ "WHERE parentItemID IS NOT NULL AND "
|
||||
+ "parentItemID IN (SELECT itemID FROM deletedItems))"
|
||||
+ ")";
|
||||
|
|
|
@ -20,6 +20,14 @@ describe("Zotero.ItemTreeView", function() {
|
|||
win.close();
|
||||
});
|
||||
|
||||
it("shouldn't show items in trash", function* () {
|
||||
var item = yield createDataObject('item', { title: "foo" });
|
||||
var itemID = item.id;
|
||||
item.deleted = true;
|
||||
yield item.saveTx();
|
||||
assert.notOk(itemsView.getRowIndexByID(itemID));
|
||||
})
|
||||
|
||||
describe("#selectItem()", function () {
|
||||
/**
|
||||
* Make sure that selectItem() doesn't hang if the pane's item-select handler is never
|
||||
|
|
Loading…
Reference in New Issue
Block a user