fix: handle default requests when using pages

The default page shows the pending requests which were working OK if one
used the Filters button. This fixes the case when someone submits by
using the pager (Next, Last etc).

Closes: #405

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
This commit is contained in:
Leonidas Spyropoulos 2022-11-08 13:14:42 +00:00
parent c248a74f80
commit 73f0bddf0b
No known key found for this signature in database
GPG key ID: 59E43E106B247368
2 changed files with 54 additions and 2 deletions

View file

@ -18,6 +18,13 @@ from aurweb.requests.util import get_pkgreq_by_id
from aurweb.scripts import notify
from aurweb.templates import make_context, render_template
FILTER_PARAMS = {
"filter_pending",
"filter_closed",
"filter_accepted",
"filter_rejected",
}
router = APIRouter()
@ -36,7 +43,7 @@ async def requests(
context["q"] = dict(request.query_params)
if len(dict(request.query_params)) == 0:
if not dict(request.query_params).keys() & FILTER_PARAMS:
filter_pending = True
O, PP = util.sanitize_params(O, PP)
@ -89,7 +96,6 @@ async def requests(
.offset(O)
.all()
)
return render_template(request, "requests.html", context)