(sender, instance, **kwargs)
| 72 | |
| 73 | @receiver(post_save, sender=AuditLog) |
| 74 | def call_webhooks(sender, instance, **kwargs): # type: ignore[no-untyped-def] |
| 75 | if settings.DISABLE_WEBHOOKS: |
| 76 | return |
| 77 | |
| 78 | if not (instance.project_id or instance.environment_id): |
| 79 | logger.warning("Audit log without project or environment. Not sending webhook.") |
| 80 | return |
| 81 | |
| 82 | organisation_id = ( |
| 83 | instance.project.organisation_id |
| 84 | if instance.project |
| 85 | else instance.environment.project.organisation_id |
| 86 | ) |
| 87 | |
| 88 | if OrganisationWebhook.objects.filter( |
| 89 | organisation_id=organisation_id, enabled=True |
| 90 | ).exists(): |
| 91 | data = AuditLogListSerializer(instance=instance).data |
| 92 | call_organisation_webhooks.delay( |
| 93 | args=(organisation_id, data, WebhookEventType.AUDIT_LOG_CREATED.value) |
| 94 | ) |
| 95 | |
| 96 | |
| 97 | def track_only(types: list[RelatedObjectType]) -> _DecoratedSignal: |
searching dependent graphs…