mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 11:57:37 -02:30
Fixed and updated activity stream delete operations
Switched to using pre_delete instead of post_delete to record activity stream delete operations so we have access to all of the fields that may be associated with the field (eg things that may be being deleted with this object through a cascade delete). Switched to recording the full dict of the object instead of a diff (since the diff will always be empty).
This commit is contained in:
@@ -340,14 +340,10 @@ def activity_stream_update(sender, instance, **kwargs):
|
||||
def activity_stream_delete(sender, instance, **kwargs):
|
||||
if not activity_stream_enabled:
|
||||
return
|
||||
try:
|
||||
old = sender.objects.get(id=instance.id)
|
||||
except sender.DoesNotExist:
|
||||
return
|
||||
# Skip recording any inventory source directly associated with a group.
|
||||
if isinstance(instance, InventorySource) and instance.group:
|
||||
return
|
||||
changes = model_instance_diff(old, instance)
|
||||
changes = model_to_dict(instance)
|
||||
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
||||
activity_entry = ActivityStream(
|
||||
operation='delete',
|
||||
|
||||
Reference in New Issue
Block a user