Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

webhooks/sentry: Improve code comments regarding event types.

Niloth Pd1187dd1f00c
diff --git a/zerver/webhooks/sentry/view.py b/zerver/webhooks/sentry/view.py
index 8c1d15279ed..1f5703225fb 100644
--- a/zerver/webhooks/sentry/view.py
+++ b/zerver/webhooks/sentry/view.py
@@ -289,6 +289,9 @@ def transform_webhook_payload(payload: dict[str, Any]) -> dict[str, Any] | None:
return payload
+ALL_EVENT_TYPES = ["event_alert", "issue"]
+
+
@webhook_view("Sentry")
@typed_endpoint
def api_sentry_webhook(
@@ -297,12 +300,14 @@ def api_sentry_webhook(
*,
payload: JsonBodyPayload[dict[str, Any]],
) -> HttpResponse:
+ # This webhook integration uses the payload structure instead of the
+ # Sentry-Hook-Resource header to determine the type of event.
+ # TODO: Investigate switching to use headers for event types.
data = payload.get("data", None)
if data is None:
data = transform_webhook_payload(payload)
- # We currently support two types of payloads: events and issues.
if data:
if "event" in data:
topic_name, body = handle_exception_or_log_entry_payloads(data["event"])