From 040c9bc3e62a41dde83fa44c53fc36ec12bdcd54 Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Thu, 17 Feb 2022 15:30:32 -0800 Subject: [PATCH] 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)