MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / call_webhooks

Function call_webhooks

api/audit/signals.py:74–94  ·  view source on GitHub ↗
(sender, instance, **kwargs)

Source from the content-addressed store, hash-verified

72
73@receiver(post_save, sender=AuditLog)
74def 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
97def track_only(types: list[RelatedObjectType]) -> _DecoratedSignal:

Calls 2

existsMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…