From 17ec5828048baa9ef65af5a9d3c94d345fbedad0 Mon Sep 17 00:00:00 2001 From: undefined Date: Sat, 6 Dec 2025 14:22:31 +0000 Subject: [PATCH] Revert "core&ui: fix pagination sort parameter (#1094)" (#1097) --- packages/hydrooj/src/handler/problem.ts | 9 +++------ packages/ui-default/templates/partials/problem_list.html | 4 ++-- .../ui-default/templates/partials/problem_lucky.html | 2 +- packages/ui-default/templates/problem_main.html | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 28b6ba602..042869563 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -170,17 +170,15 @@ export class ProblemMainHandler extends Handler { pdocs.map((i) => i.docId), )); } - let qs = sortStrategy !== 'default' ? `sort=${sortStrategy}` : ''; - if (q) qs += `${qs ? '&' : ''}q=${encodeURIComponent(q)}`; if (pjax) { this.response.body = { title: this.renderTitle(this.translate('problem_main')), fragments: (await Promise.all([ this.renderHTML('partials/problem_list.html', { - page, ppcount, pcount, pdocs, psdict, qs, q, sort: sortStrategy, + page, ppcount, pcount, pdocs, psdict, qs: q, sort: sortStrategy, }), this.renderHTML('partials/problem_stat.html', { pcount, pcountRelation: this.queryContext.pcountRelation }), - this.renderHTML('partials/problem_lucky.html', { q }), + this.renderHTML('partials/problem_lucky.html', { qs: q }), ])).map((i) => ({ html: i })), }; } else { @@ -191,8 +189,7 @@ export class ProblemMainHandler extends Handler { pcountRelation: this.queryContext.pcountRelation, pdocs, psdict, - qs, - q, + qs: q, sort: sortStrategy, }; } diff --git a/packages/ui-default/templates/partials/problem_list.html b/packages/ui-default/templates/partials/problem_list.html index fcd743150..259cc4df9 100644 --- a/packages/ui-default/templates/partials/problem_list.html +++ b/packages/ui-default/templates/partials/problem_list.html @@ -6,7 +6,7 @@ {% if not pdocs.length %} {{ nothing.render('Sorry, there are no problems in the problem set.') }} {% else %} - {{ paginator.render(page, ppcount, position='top', add_qs=qs) }} + {{ paginator.render(page, ppcount, position='top', add_qs=('q=' + qs if qs else '')) }} @@ -63,6 +63,6 @@ {%- endfor -%}
- {{ paginator.render(page, ppcount, add_qs=qs) }} + {{ paginator.render(page, ppcount, add_qs=('q=' + qs if qs else '')) }} {% endif %} diff --git a/packages/ui-default/templates/partials/problem_lucky.html b/packages/ui-default/templates/partials/problem_lucky.html index 5b0aa7594..bc127a6b1 100644 --- a/packages/ui-default/templates/partials/problem_lucky.html +++ b/packages/ui-default/templates/partials/problem_lucky.html @@ -1,6 +1,6 @@

- + {{ _('Lucky') }}

diff --git a/packages/ui-default/templates/problem_main.html b/packages/ui-default/templates/problem_main.html index 547c18dc4..29e183bbd 100644 --- a/packages/ui-default/templates/problem_main.html +++ b/packages/ui-default/templates/problem_main.html @@ -8,7 +8,7 @@