From 14adce7ec96694acef46000dd5a6be421bc50944 Mon Sep 17 00:00:00 2001
From: Tim Hostetler <6970899+thostetler@users.noreply.github.com>
Date: Sat, 10 Jan 2026 17:52:41 +0000
Subject: [PATCH] feat(preferences): add ALL option for authors visible per
result
Re-enable the "ALL" option in the user preferences for "Authors Visible
Per Result" setting. When selected, this skips the [fields xxx] query
limiters, allowing users to see all authors on results pages without
needing to expand each paper individually.
The backend already supported this value but the UI option was removed.
This restores it with a help text warning about potential slower load
times for papers with many authors.
---
.../widgets/preferences/templates/application.html | 1 +
src/js/widgets/preferences/views/application.js | 6 +++++-
test/mocha/js/widgets/results_render_widget.spec.js | 12 ++++++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/js/widgets/preferences/templates/application.html b/src/js/widgets/preferences/templates/application.html
index 5c1e3a780..d50996a28 100644
--- a/src/js/widgets/preferences/templates/application.html
+++ b/src/js/widgets/preferences/templates/application.html
@@ -22,6 +22,7 @@
Specifies the number of authors to show under each result before the list is truncated.
+ Selecting "ALL" may result in slower load times for papers with many authors.
(
default: {{numAuthorsDefault}})
diff --git a/src/js/widgets/preferences/views/application.js b/src/js/widgets/preferences/views/application.js
index 478eccb82..ed8ff603f 100644
--- a/src/js/widgets/preferences/views/application.js
+++ b/src/js/widgets/preferences/views/application.js
@@ -6,7 +6,7 @@ define([
], function (_, Marionette, ApplicationTemplate, config) {
var DEFAULTS = {
numAuthors: {
- initialOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
+ initialOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'ALL'],
initialValue: 4,
},
externalLinks: {
@@ -209,6 +209,10 @@ define([
_convertToNumber: function (val) {
try {
+ var normalized = String(val).toUpperCase();
+ if (normalized === 'ALL' || normalized === 'NONE') {
+ return normalized;
+ }
return _.isNaN(Number(val)) ? val : Number(val);
} catch (e) {
return val;
diff --git a/test/mocha/js/widgets/results_render_widget.spec.js b/test/mocha/js/widgets/results_render_widget.spec.js
index 859424519..2bb75fe3d 100644
--- a/test/mocha/js/widgets/results_render_widget.spec.js
+++ b/test/mocha/js/widgets/results_render_widget.spec.js
@@ -158,6 +158,18 @@ define([
expect(result).to.include('[fields orcid_other=5]');
});
+ it("Should NOT apply field limiters when minAuthorsPerResult is 'ALL'", function () {
+ const widget = _getWidget();
+ // Simulate 'ALL' setting which gets converted to POSITIVE_INFINITY
+ widget.minAuthorsPerResult = Number.POSITIVE_INFINITY;
+ const result = widget.customizeQuery(new ApiQuery({q: "star"})).get('fl')[0].split(',');
+ // Verify no [fields xxx] limiters are present
+ const hasFieldLimiters = result.some(function(field) {
+ return field.indexOf('[fields ') === 0;
+ });
+ expect(hasFieldLimiters).to.be.false;
+ });
+
it.skip("should listen to INVITING_REQUEST event", function (done) {
var stub = function (apiResponse) {