fix: add comments in email for direct deletion/merge

TUs and Devs can delete and merge packages directly.
Currently the comments they enter, don't end up in the ML notification.

Include the comment in the notifications for direct deletion / merge

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-03-14 11:17:45 +01:00
parent 7d1827ffc5
commit b9df7541b3
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
3 changed files with 60 additions and 4 deletions

View file

@ -153,7 +153,11 @@ def close_pkgreq(
@db.retry_deadlock
def handle_request(
request: Request, reqtype_id: int, pkgbase: PackageBase, target: PackageBase = None
request: Request,
reqtype_id: int,
pkgbase: PackageBase,
target: PackageBase = None,
comments: str = str(),
) -> list[notify.Notification]:
"""
Handle package requests before performing an action.
@ -228,7 +232,7 @@ def handle_request(
PackageBase=pkgbase,
PackageBaseName=pkgbase.Name,
Comments="Autogenerated by aurweb.",
ClosureComment=str(),
ClosureComment=comments,
)
# If it's a merge request, set MergeBaseName to `target`.Name.

View file

@ -133,7 +133,7 @@ def pkgbase_delete_instance(
request: Request, pkgbase: PackageBase, comments: str = str()
) -> list[notify.Notification]:
notif = notify.DeleteNotification(request.user.ID, pkgbase.ID)
notifs = handle_request(request, DELETION_ID, pkgbase) + [notif]
notifs = handle_request(request, DELETION_ID, pkgbase, comments=comments) + [notif]
_retry_delete(pkgbase, comments)
@ -181,7 +181,7 @@ def pkgbase_merge_instance(
pkgbasename = str(pkgbase.Name)
# Create notifications.
notifs = handle_request(request, MERGE_ID, pkgbase, target)
notifs = handle_request(request, MERGE_ID, pkgbase, target, comments)
_retry_merge(pkgbase, target)