Fixes #16808: Correct event type of webhooks emitted upon object deletion immediately following a modification

This commit is contained in:
Jeremy Stretch
2024-07-04 11:02:28 -04:00
parent f2e3c1a219
commit 7564f6f538
2 changed files with 31 additions and 5 deletions

View File

@@ -63,6 +63,9 @@ def enqueue_object(queue, instance, user, request_id, action):
if key in queue:
queue[key]['data'] = serialize_for_event(instance)
queue[key]['snapshots']['postchange'] = get_snapshots(instance, action)['postchange']
# If the object is being deleted, update any prior "update" event to "delete"
if action == ObjectChangeActionChoices.ACTION_DELETE:
queue[key]['event'] = action
else:
queue[key] = {
'content_type': ContentType.objects.get_for_model(instance),