Fix "false" in Added By/Modified By columns for trashed collections

The row values were computed with `row.isItem && …`, so collection and
search rows in the trash got the boolean `false`, which the table then
rendered as the text "false".

https://forums.zotero.org/discussion/133560/

(cherry picked from commit 08ed64f17f)
This commit is contained in:
Dan Stillman 2026-09-02 11:28:47 -04:00
parent dbffb22ce3
commit f908bcadfa
2 changed files with 16 additions and 2 deletions

View file

@ -2403,8 +2403,8 @@ var ItemTree = class ItemTree extends LibraryTree {
row.numNotes = treeRow.numNotes() || "";
row.feed = (treeRow.ref.isFeedItem && Zotero.Feeds.get(treeRow.ref.libraryID).name) || "";
row.lastRead = row.isItem ? treeRow.ref.getItemLastRead() : "";
row.addedBy = row.isItem && treeRow.getAddedBy();
row.lastModifiedBy = row.isItem && treeRow.getLastModifiedBy();
row.addedBy = row.isItem ? treeRow.getAddedBy() : "";
row.lastModifiedBy = row.isItem ? treeRow.getLastModifiedBy() : "";
row.title = treeRow.getDisplayTitle();
const columns = this.getColumns();

View file

@ -1989,6 +1989,20 @@ describe("CollectionViewItemTree", function () {
assert.equal(itemsView.getRow(searchRowIndex).type, 'search');
});
it("shouldn't show a value in Added By/Modified By for trashed collections and searches", async function () {
let collection = await createDataObject('collection', { deleted: true });
let search = await createDataObject('search', { deleted: true });
await selectTrash(win);
for (let obj of [collection, search]) {
let row = itemsView.getRowIndexByID(obj.treeViewID);
assert.isNumber(row);
assert.strictEqual(itemsView.getCellText(row, 'addedBy'), "");
assert.strictEqual(itemsView.getCellText(row, 'lastModifiedBy'), "");
}
});
it("shouldn't show trashed collections or searches when an advanced search is active", async function () {
let item = await createDataObject('item', { title: "advancedTrashMatch", deleted: true });
let collection = await createDataObject('collection', { name: "advancedTrashMatch", deleted: true });