Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks/freshdesk: Remove key checking step.
Hemanth V. Allurieb2809effe60
diff --git a/zerver/webhooks/freshdesk/tests.py b/zerver/webhooks/freshdesk/tests.pyindex 0ff3924e08d..5a45fb2636a 100644--- a/zerver/webhooks/freshdesk/tests.py+++ b/zerver/webhooks/freshdesk/tests.py@@ -43,19 +43,6 @@ Requester Bob <[email protected]> updated [ticket #11](http://test1234zzself.api_stream_message(self.test_user, 'status_changed', expected_topic, expected_message,content_type="application/x-www-form-urlencoded")- def test_status_change_fixture_without_required_key(self) -> None:- """- A fixture without the requisite keys should raise JsonableError.- """- self.url = self.build_webhook_url()- payload = self.get_body('status_changed_fixture_with_missing_key')- kwargs = {- 'HTTP_AUTHORIZATION': self.encode_email(self.test_user.email),- 'content_type': 'application/x-www-form-urlencoded',- }- result = self.client_post(self.url, payload, **kwargs)- self.assert_json_error(result, 'Missing key triggered_event in JSON')-def test_priority_change(self) -> None:"""Messages are generated when a ticket's priority changes throughdiff --git a/zerver/webhooks/freshdesk/view.py b/zerver/webhooks/freshdesk/view.pyindex 7c07f46c0f7..a5f11b0195c 100644--- a/zerver/webhooks/freshdesk/view.py+++ b/zerver/webhooks/freshdesk/view.py@@ -1,14 +1,12 @@"""Webhooks for external integrations."""-import loggingfrom typing import Any, Dict, Listfrom django.http import HttpRequest, HttpResponse-from django.utils.translation import ugettext as _from zerver.decorator import authenticated_rest_api_viewfrom zerver.lib.email_notifications import convert_html_to_markdownfrom zerver.lib.request import REQ, has_request_variables-from zerver.lib.response import json_error, json_success+from zerver.lib.response import json_successfrom zerver.lib.webhooks.common import check_send_webhook_messagefrom zerver.models import UserProfile@@ -136,18 +134,6 @@ def api_freshdesk_webhook(request: HttpRequest, user_profile: UserProfile,payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:ticket_data = payload["freshdesk_webhook"]- required_keys = [- "triggered_event", "ticket_id", "ticket_url", "ticket_type",- "ticket_subject", "ticket_description", "ticket_status",- "ticket_priority", "requester_name", "requester_email",- ]-- for key in required_keys:- if ticket_data.get(key) is None:- logging.warning("Freshdesk webhook error. Payload was:")- logging.warning(request.body)- return json_error(_("Missing key {} in JSON").format(key))-ticket = TicketDict(ticket_data)subject = f"#{ticket.id}: {ticket.subject}"