Merge branch 'master' into live

This commit is contained in:
Kevin Morris 2022-02-11 02:07:04 -08:00
commit 2f9f2b4ab5
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
4 changed files with 14 additions and 2 deletions

View file

@ -6,7 +6,7 @@ from typing import Any
# Publicly visible version of aurweb. This is used to display # Publicly visible version of aurweb. This is used to display
# aurweb versioning in the footer and must be maintained. # aurweb versioning in the footer and must be maintained.
# Todo: Make this dynamic/automated. # Todo: Make this dynamic/automated.
AURWEB_VERSION = "v6.0.10" AURWEB_VERSION = "v6.0.11"
_parser = None _parser = None

View file

@ -187,6 +187,9 @@ async def pkgbase_comments_post(
PackageBase=pkgbase) PackageBase=pkgbase)
update_comment_render_fastapi(comment) update_comment_render_fastapi(comment)
notif = notify.CommentNotification(request.user.ID, pkgbase.ID, comment.ID)
notif.send()
# Redirect to the pkgbase page. # Redirect to the pkgbase page.
return RedirectResponse(f"/pkgbase/{pkgbase.Name}#comment-{comment.ID}", return RedirectResponse(f"/pkgbase/{pkgbase.Name}#comment-{comment.ID}",
status_code=HTTPStatus.SEE_OTHER) status_code=HTTPStatus.SEE_OTHER)

View file

@ -8,7 +8,7 @@
# #
[tool.poetry] [tool.poetry]
name = "aurweb" name = "aurweb"
version = "v6.0.10" version = "v6.0.11"
license = "GPL-2.0-only" license = "GPL-2.0-only"
description = "Source code for the Arch User Repository's website" description = "Source code for the Arch User Repository's website"
homepage = "https://aur.archlinux.org" homepage = "https://aur.archlinux.org"

View file

@ -370,6 +370,12 @@ def test_pkgbase_comments(client: TestClient, maintainer: User, user: User,
- GET /pkgbase/{name}/comments/{id}/form - GET /pkgbase/{name}/comments/{id}/form
- Tested against a comment created with the POST route - 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")} cookies = {"AURSID": maintainer.login(Request(), "testPassword")}
pkgbasename = package.PackageBase.Name pkgbasename = package.PackageBase.Name
endpoint = f"/pkgbase/{pkgbasename}/comments" endpoint = f"/pkgbase/{pkgbasename}/comments"
@ -380,6 +386,9 @@ def test_pkgbase_comments(client: TestClient, maintainer: User, user: User,
}, cookies=cookies) }, cookies=cookies)
assert resp.status_code == int(HTTPStatus.SEE_OTHER) assert resp.status_code == int(HTTPStatus.SEE_OTHER)
# user should've gotten a CommentNotification email.
assert Email.count() == 1
expected_prefix = f"/pkgbase/{pkgbasename}" expected_prefix = f"/pkgbase/{pkgbasename}"
prefix_len = len(expected_prefix) prefix_len = len(expected_prefix)
assert resp.headers.get("location")[:prefix_len] == expected_prefix assert resp.headers.get("location")[:prefix_len] == expected_prefix