Verified Commit 040c9bc3 authored by Kevin Morris's avatar Kevin Morris
Browse files

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's avatarKevin Morris <kevr@0cost.org>
parent 640630fa
Pipeline #15936 passed with stages
in 3 minutes and 1 second
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment