feat: cancel button for comment editing

Adds button that allows cancellation while editing a comment

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-03-08 18:40:35 +01:00
parent 52c962a590
commit 7d1827ffc5
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
4 changed files with 35 additions and 0 deletions

View file

@ -293,8 +293,14 @@ async def pkgbase_comment_post(
comment: str = Form(default=str()),
enable_notifications: bool = Form(default=False),
next: str = Form(default=None),
cancel: bool = Form(default=False),
):
"""Edit an existing comment."""
if cancel:
return RedirectResponse(
f"/pkgbase/{name}#comment-{id}", status_code=HTTPStatus.SEE_OTHER
)
pkgbase = get_pkg_or_base(name, PackageBase)
db_comment = get_pkgbase_comment(pkgbase, id)