numDistinctFileAttachmentsForLabel: Filter best attachment
This commit is contained in:
parent
bc64f06352
commit
90634fc5c8
1 changed files with 3 additions and 2 deletions
|
@ -1834,7 +1834,7 @@ Zotero.Items = function() {
|
||||||
* array of items (which can include both parent and child items) in order to display a menu
|
* array of items (which can include both parent and child items) in order to display a menu
|
||||||
* label (e.g., "Show File" or "Show Files")
|
* label (e.g., "Show File" or "Show Files")
|
||||||
*
|
*
|
||||||
* @param {[Zotero.Item]}
|
* @param {[Zotero.Item]} items
|
||||||
* @param {Function} filter - An additional filter function to run on file attachment items to
|
* @param {Function} filter - An additional filter function to run on file attachment items to
|
||||||
* determine if they qualify
|
* determine if they qualify
|
||||||
* @return {Integer} - 0, 1, or 2, where 2 means >1
|
* @return {Integer} - 0, 1, or 2, where 2 means >1
|
||||||
|
@ -1849,7 +1849,8 @@ Zotero.Items = function() {
|
||||||
// multiple files, but getBestAttachment() is asynchronous and we need to do this
|
// multiple files, but getBestAttachment() is asynchronous and we need to do this
|
||||||
// synchronously, so try to use the cached best-attachment state
|
// synchronously, so try to use the cached best-attachment state
|
||||||
let { key } = item.getBestAttachmentStateCached();
|
let { key } = item.getBestAttachmentStateCached();
|
||||||
if (key) {
|
let bestAttachment = key && Zotero.Items.getByLibraryAndKey(item.libraryID, key);
|
||||||
|
if (bestAttachment && filter(bestAttachment)) {
|
||||||
if (foundKey) {
|
if (foundKey) {
|
||||||
if (key == foundKey) {
|
if (key == foundKey) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Reference in a new issue