From 3440ee16f2b83c5e72e312d949e5915feded77ab Mon Sep 17 00:00:00 2001 From: pajowu Date: Tue, 29 Sep 2026 11:51:29 +0200 Subject: [PATCH] Plugin List: Apply search filter if prefilled by browser (#6543) * Plugin List: Apply searchfilter if prefilled by browser Browsers often prefill the form fields, e.g. with their old content when reloading or going back from the previous page. However these filters were not applied until you changed one of the form fields * Fix linting errors in plugins.js * Apply review suggestions --- eslint.config.mjs | 1 - src/pretix/static/pretixcontrol/js/ui/plugins.js | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 8c047a197f..af255893e8 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -49,7 +49,6 @@ const ignores = globalIgnores([ 'src/pretix/static/pretixcontrol/js/ui/editor.js', 'src/pretix/static/pretixcontrol/js/ui/geo.js', 'src/pretix/static/pretixcontrol/js/ui/main.js', - 'src/pretix/static/pretixcontrol/js/ui/plugins.js', 'src/pretix/static/pretixcontrol/js/ui/subevent.js', 'src/pretix/static/pretixcontrol/js/ui/variations.js', 'src/pretix/static/pretixcontrol/js/ui/webauthn.js', diff --git a/src/pretix/static/pretixcontrol/js/ui/plugins.js b/src/pretix/static/pretixcontrol/js/ui/plugins.js index 6b698b0568..14e43aa905 100644 --- a/src/pretix/static/pretixcontrol/js/ui/plugins.js +++ b/src/pretix/static/pretixcontrol/js/ui/plugins.js @@ -67,8 +67,8 @@ $(function () { continue matches.push([rank, plugin]) } - matches.sort(function (a, b) { return (b[0] - a[0]) || strcmp(a[1].sortName, b[1].sortName) }) - $results.append(matches.map(function (res) { return $(res[1].html).prepend('' + res[1].categoryLabel + '') })) + matches.sort((a, b) => ((b[0] - a[0]) || strcmp(a[1].sortName, b[1].sortName))) + $results.append(matches.map((res) => $(res[1].html).prepend('' + res[1].categoryLabel + ''))) $results.find('.panel-body, .panel, .featured-plugin, .btn-lg').removeClass('panel-body panel featured-plugin btn-lg') if (matches.length === 0) { $results.append(gettext('No results')) @@ -81,9 +81,10 @@ $(function () { $('#plugin_search_input').val('').trigger('input') }) if (location.search) { - var search = new URLSearchParams(location.search) - if (search.has('q')) { - $('#plugin_search_input').val(search.get('q')).trigger('input') + const search_params = new URLSearchParams(location.search) + if (search_params.has('q')) { + $('#plugin_search_input').val(search_params.get('q')) } } + search() // if pre-filled by browser (e.g. after reload) })