Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
statuspage: Properly detect the update is for component or incident.
Vishnu KS92316ef4d121
diff --git a/zerver/webhooks/statuspage/fixtures/incident_created.json b/zerver/webhooks/statuspage/fixtures/incident_created.jsonindex 9dda2569b1d..9c4cac54db8 100644--- a/zerver/webhooks/statuspage/fixtures/incident_created.json+++ b/zerver/webhooks/statuspage/fixtures/incident_created.json@@ -6,7 +6,7 @@},"page": {"id": "jb7j80lkgqvb",- "status_indicator": "none",+ "status_indicator": "critical","status_description": "All Systems Operational"},"incident": {diff --git a/zerver/webhooks/statuspage/view.py b/zerver/webhooks/statuspage/view.pyindex 564b0967de5..140331df01d 100644--- a/zerver/webhooks/statuspage/view.py+++ b/zerver/webhooks/statuspage/view.py@@ -4,6 +4,7 @@ from typing import Any, Dictfrom django.http import HttpRequest, HttpResponsefrom zerver.decorator import REQ, has_request_variables, webhook_view+from zerver.lib.exceptions import UnsupportedWebhookEventTypefrom zerver.lib.response import json_successfrom zerver.lib.webhooks.common import check_send_webhook_messagefrom zerver.models import UserProfile@@ -57,14 +58,14 @@ def api_statuspage_webhook(payload: Dict[str, Any] = REQ(argument_type="body"),) -> HttpResponse:- status = payload["page"]["status_indicator"]-- if status == "none":+ if "incident" in payload:topic = get_incident_topic(payload)body = get_incident_events_body(payload)- else:+ elif "component" in payload:topic = get_component_topic(payload)body = get_components_update_body(payload)+ else:+ raise UnsupportedWebhookEventType("unknown-event")check_send_webhook_message(request, user_profile, topic, body)return json_success()