From 040c9bc3e62a41dde83fa44c53fc36ec12bdcd54 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Thu, 17 Feb 2022 15:30:32 -0800 Subject: [PATCH 1/4] fix: send up to date flag notifications These were being produced with the db state before the flag was set, which is not what should be done for flag notifications, as the notification contains data about the comment and the current flagger. Closes #292 Signed-off-by: Kevin Morris --- aurweb/routers/pkgbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aurweb/routers/pkgbase.py b/aurweb/routers/pkgbase.py index 845c6372..4c0b8a67 100644 --- a/aurweb/routers/pkgbase.py +++ b/aurweb/routers/pkgbase.py @@ -150,13 +150,13 @@ async def pkgbase_flag_post(request: Request, name: str, has_cred = request.user.has_credential(creds.PKGBASE_FLAG) if has_cred and not pkgbase.OutOfDateTS: - notif = notify.FlagNotification(request.user.ID, pkgbase.ID) now = time.utcnow() with db.begin(): pkgbase.OutOfDateTS = now pkgbase.Flagger = request.user pkgbase.FlaggerComment = comments - notif.send() + + notify.FlagNotification(request.user.ID, pkgbase.ID).send() return RedirectResponse(f"/pkgbase/{name}", status_code=HTTPStatus.SEE_OTHER) From 361163098f7e074ddca76c7926e69a3fa9b2eae2 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Thu, 17 Feb 2022 15:48:58 -0800 Subject: [PATCH 2/4] fix: /packages search ordering links This was not including other parameters that should be persisted for users. Signed-off-by: Kevin Morris --- aurweb/routers/packages.py | 4 ++-- templates/partials/packages/search_results.html | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/aurweb/routers/packages.py b/aurweb/routers/packages.py index 8f6cb7d6..d4e85d20 100644 --- a/aurweb/routers/packages.py +++ b/aurweb/routers/packages.py @@ -15,7 +15,7 @@ from aurweb.packages.search import PackageSearch from aurweb.packages.util import get_pkg_or_base from aurweb.pkgbase import actions as pkgbase_actions from aurweb.pkgbase import util as pkgbaseutil -from aurweb.templates import make_context, render_template +from aurweb.templates import make_context, make_variable_context, render_template logger = logging.get_logger(__name__) router = APIRouter() @@ -125,7 +125,7 @@ async def packages_get(request: Request, context: Dict[str, Any], @router.get("/packages") async def packages(request: Request) -> Response: - context = make_context(request, "Packages") + context = await make_variable_context(request, "Packages") return await packages_get(request, context) diff --git a/templates/partials/packages/search_results.html b/templates/partials/packages/search_results.html index 680891c4..c3b4427c 100644 --- a/templates/partials/packages/search_results.html +++ b/templates/partials/packages/search_results.html @@ -9,7 +9,7 @@ {% if SB == "n" %} {% set order = "d" if order == "a" else "a" %} {% endif %} - + {{ "Name" | tr }} @@ -19,7 +19,7 @@ {% if SB == "v" %} {% set order = "d" if order == "a" else "a" %} {% endif %} - + {{ "Votes" | tr }} @@ -28,7 +28,7 @@ {% if SB == "p" %} {% set order = "d" if order == "a" else "a" %} {% endif %} - {{ "Popularity" | tr }}? + {{ "Popularity" | tr }}? {% if request.user.is_authenticated() %} @@ -36,7 +36,7 @@ {% if SB == "w" %} {% set order = "d" if order == "a" else "a" %} {% endif %} - + {{ "Voted" | tr }} @@ -45,7 +45,7 @@ {% if SB == "o" %} {% set order = "d" if order == "a" else "a" %} {% endif %} - + {{ "Notify" | tr }} @@ -56,7 +56,7 @@ {% if SB == "m" %} {% set order = "d" if order == "a" else "a" %} {% endif %} - + {{ "Maintainer" | tr }} From e3864d4b7ca21d17f3faea196509e0a5b3f23f82 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Thu, 17 Feb 2022 15:54:04 -0800 Subject: [PATCH 3/4] fix: set RequestTS when autogenerating requests Signed-off-by: Kevin Morris --- aurweb/packages/requests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aurweb/packages/requests.py b/aurweb/packages/requests.py index 724249d4..6aaa59ab 100644 --- a/aurweb/packages/requests.py +++ b/aurweb/packages/requests.py @@ -201,9 +201,11 @@ def handle_request(request: Request, reqtype_id: int, # This is done to increase tracking of actions occurring # through the website. if not to_accept: + utcnow = time.utcnow() with db.begin(): pkgreq = db.create(PackageRequest, ReqTypeID=reqtype_id, + RequestTS=utcnow, User=request.user, PackageBase=pkgbase, PackageBaseName=pkgbase.Name, From 0bfecb984482720db1b72d47799dc86812b8bfb0 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Thu, 17 Feb 2022 16:14:31 -0800 Subject: [PATCH 4/4] upgrade: bump to v6.0.14 Signed-off-by: Kevin Morris --- aurweb/config.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aurweb/config.py b/aurweb/config.py index 2a865b9b..eea156f5 100644 --- a/aurweb/config.py +++ b/aurweb/config.py @@ -6,7 +6,7 @@ from typing import Any # Publicly visible version of aurweb. This is used to display # aurweb versioning in the footer and must be maintained. # Todo: Make this dynamic/automated. -AURWEB_VERSION = "v6.0.13" +AURWEB_VERSION = "v6.0.14" _parser = None diff --git a/pyproject.toml b/pyproject.toml index 6ba0ff52..50691228 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ # [tool.poetry] name = "aurweb" -version = "v6.0.13" +version = "v6.0.14" license = "GPL-2.0-only" description = "Source code for the Arch User Repository's website" homepage = "https://aur.archlinux.org"