diff --git a/aurweb/config.py b/aurweb/config.py index 4f8ae55f..7bd7abd4 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.10" +AURWEB_VERSION = "v6.0.11" _parser = None diff --git a/aurweb/routers/pkgbase.py b/aurweb/routers/pkgbase.py index 23651350..cd35a7f8 100644 --- a/aurweb/routers/pkgbase.py +++ b/aurweb/routers/pkgbase.py @@ -187,6 +187,9 @@ async def pkgbase_comments_post( PackageBase=pkgbase) update_comment_render_fastapi(comment) + notif = notify.CommentNotification(request.user.ID, pkgbase.ID, comment.ID) + notif.send() + # Redirect to the pkgbase page. return RedirectResponse(f"/pkgbase/{pkgbase.Name}#comment-{comment.ID}", status_code=HTTPStatus.SEE_OTHER) diff --git a/pyproject.toml b/pyproject.toml index 2bd77eba..5afa6d6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ # [tool.poetry] name = "aurweb" -version = "v6.0.10" +version = "v6.0.11" license = "GPL-2.0-only" description = "Source code for the Arch User Repository's website" homepage = "https://aur.archlinux.org" diff --git a/test/test_pkgbase_routes.py b/test/test_pkgbase_routes.py index 1bd3e524..03b55063 100644 --- a/test/test_pkgbase_routes.py +++ b/test/test_pkgbase_routes.py @@ -370,6 +370,12 @@ def test_pkgbase_comments(client: TestClient, maintainer: User, user: User, - GET /pkgbase/{name}/comments/{id}/form - Tested against a comment created with the POST route """ + with db.begin(): + user.CommentNotify = 1 + db.create(PackageNotification, + PackageBase=package.PackageBase, + User=user) + cookies = {"AURSID": maintainer.login(Request(), "testPassword")} pkgbasename = package.PackageBase.Name endpoint = f"/pkgbase/{pkgbasename}/comments" @@ -380,6 +386,9 @@ def test_pkgbase_comments(client: TestClient, maintainer: User, user: User, }, cookies=cookies) assert resp.status_code == int(HTTPStatus.SEE_OTHER) + # user should've gotten a CommentNotification email. + assert Email.count() == 1 + expected_prefix = f"/pkgbase/{pkgbasename}" prefix_len = len(expected_prefix) assert resp.headers.get("location")[:prefix_len] == expected_prefix