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.isSeparator = function(row) { return false; }
|
||||||
|
Zotero.ItemTreeView.prototype.isSelectable = function (row, col) { return true; }
|
||||||
Zotero.ItemTreeView.prototype.getRowProperties = function(row, prop) {}
|
Zotero.ItemTreeView.prototype.getRowProperties = function(row, prop) {}
|
||||||
Zotero.ItemTreeView.prototype.getColumnProperties = function(col, prop) {}
|
Zotero.ItemTreeView.prototype.getColumnProperties = function(col, prop) {}
|
||||||
Zotero.ItemTreeView.prototype.getCellProperties = function(row, col, prop) {
|
Zotero.ItemTreeView.prototype.getCellProperties = function(row, col, prop) {
|
||||||
|
|
|
@ -82,9 +82,11 @@ Zotero.LibraryTreeView.prototype = {
|
||||||
* @return {Integer}
|
* @return {Integer}
|
||||||
*/
|
*/
|
||||||
getRowIndexByID: function (id) {
|
getRowIndexByID: function (id) {
|
||||||
// FIXME: Should work for itemIDs too
|
var type = "";
|
||||||
var type = id[0];
|
if (this.type != 'item') {
|
||||||
id = ('' + id).substr(1);
|
var type = id[0];
|
||||||
|
id = ('' + id).substr(1);
|
||||||
|
}
|
||||||
return this._rowMap[type + id];
|
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
|
// Exclude deleted items (and their child items) by default
|
||||||
|
let not = deleted ? "" : "NOT ";
|
||||||
|
let op = deleted ? "OR" : "AND";
|
||||||
sql += " WHERE ("
|
sql += " WHERE ("
|
||||||
+ "itemID " + (deleted ? "" : "NOT ") + "IN (SELECT itemID FROM deletedItems) "
|
+ `itemID ${not} IN (SELECT itemID FROM deletedItems) `
|
||||||
+ "OR itemID " + (deleted ? "" : "NOT ") + "IN (SELECT itemID FROM itemNotes "
|
+ `${op} itemID ${not}IN (SELECT itemID FROM itemNotes `
|
||||||
+ "WHERE parentItemID IS NOT NULL AND "
|
+ "WHERE parentItemID IS NOT NULL AND "
|
||||||
+ "parentItemID IN (SELECT itemID FROM deletedItems)) "
|
+ "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 "
|
+ "WHERE parentItemID IS NOT NULL AND "
|
||||||
+ "parentItemID IN (SELECT itemID FROM deletedItems))"
|
+ "parentItemID IN (SELECT itemID FROM deletedItems))"
|
||||||
+ ")";
|
+ ")";
|
||||||
|
|
|
@ -20,6 +20,14 @@ describe("Zotero.ItemTreeView", function() {
|
||||||
win.close();
|
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 () {
|
describe("#selectItem()", function () {
|
||||||
/**
|
/**
|
||||||
* Make sure that selectItem() doesn't hang if the pane's item-select handler is never
|
* Make sure that selectItem() doesn't hang if the pane's item-select handler is never
|
||||||
|
|
Loading…
Reference in New Issue
Block a user