Merge branch 'master' into live

This commit is contained in:
Kevin Morris 2022-02-05 04:40:52 -08:00
commit 405c05b499
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 8 additions and 0 deletions

View file

@ -276,6 +276,9 @@ async def account_register_post(request: Request,
args["K"] = args.get("K", str()).replace(" ", "") args["K"] = args.get("K", str()).replace(" ", "")
K = args.get("K") K = args.get("K")
# Force "H" into a boolean.
args["H"] = H = (args.get("H", str()) == "on")
context = make_account_form_context(context, request, None, args) context = make_account_form_context(context, request, None, args)
ok, errors = process_account_form(request, request.user, args) ok, errors = process_account_form(request, request.user, args)
if not ok: if not ok:

View file

@ -145,11 +145,13 @@ async def pkgbase_flag_post(request: Request, name: str,
has_cred = request.user.has_credential(creds.PKGBASE_FLAG) has_cred = request.user.has_credential(creds.PKGBASE_FLAG)
if has_cred and not pkgbase.OutOfDateTS: if has_cred and not pkgbase.OutOfDateTS:
notif = notify.FlagNotification(request.user.ID, pkgbase.ID)
now = time.utcnow() now = time.utcnow()
with db.begin(): with db.begin():
pkgbase.OutOfDateTS = now pkgbase.OutOfDateTS = now
pkgbase.Flagger = request.user pkgbase.Flagger = request.user
pkgbase.FlaggerComment = comments pkgbase.FlaggerComment = comments
notif.send()
return RedirectResponse(f"/pkgbase/{name}", return RedirectResponse(f"/pkgbase/{name}",
status_code=HTTPStatus.SEE_OTHER) status_code=HTTPStatus.SEE_OTHER)

View file

@ -836,6 +836,9 @@ def test_pkgbase_flag(client: TestClient, user: User, maintainer: User,
assert pkgbase.Flagger == user assert pkgbase.Flagger == user
assert pkgbase.FlaggerComment == "Test" assert pkgbase.FlaggerComment == "Test"
# Should've gotten a FlagNotification.
assert Email.count() == 1
# Now, let's check the /pkgbase/{name}/flag-comment route. # Now, let's check the /pkgbase/{name}/flag-comment route.
flag_comment_endpoint = f"/pkgbase/{pkgbase.Name}/flag-comment" flag_comment_endpoint = f"/pkgbase/{pkgbase.Name}/flag-comment"
with client as request: with client as request: