From b54466f089b8933025f2f0fbf6ea56f24eea602e Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Mon, 28 Feb 2022 08:18:59 -0700 Subject: [PATCH] Fix error restoring top-level notes & attachments Fixes #2369 --- chrome/content/zotero/zoteroPane.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index a3220e06cf..6ee28ebcb2 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -1946,6 +1946,9 @@ var ZoteroPane = new function() } let parent = this.itemsView.getRow(row).ref; + let children = []; + if (!parent.isNote()) children.push(...parent.getNotes(true)); + if (!parent.isAttachment()) children.push(...parent.getAttachments(true)); if (isSelected(parent)) { if (parent.deleted) { @@ -1953,7 +1956,6 @@ var ZoteroPane = new function() await parent.save(); } - let children = [...parent.getNotes(true), ...parent.getAttachments(true)]; let noneSelected = !children.some(isSelected); for (let child of Zotero.Items.get(children)) { if ((noneSelected || isSelected(child)) && child.deleted) { @@ -1963,7 +1965,6 @@ var ZoteroPane = new function() } } else { - let children = [...parent.getNotes(true), ...parent.getAttachments(true)]; for (let child of Zotero.Items.get(children)) { if (isSelected(child) && child.deleted) { child.deleted = false;