mirror of https://github.com/zulip/zulip.git
integrations: Improve message formatting for Jotform.
This commit is contained in:
parent
31fb2fbe7c
commit
87bdb41214
|
@ -10,10 +10,9 @@ class JotformHookTests(WebhookTestCase):
|
|||
expected_title = "Form"
|
||||
expected_message = """
|
||||
A new submission (ID 4791133489169827307) was received:
|
||||
* Name:Gaurav Pandey
|
||||
* Address:Lampgarden-street wolfsquare Bengaluru Karnataka 165578
|
||||
* Signature:uploads/gauravguitarrocks/202944822449057/4791133489169827307/4791133489169827307_signature_4.png
|
||||
""".strip()
|
||||
* *Name*: Gaurav Pandey
|
||||
* *Address*: Lampgarden-street wolfsquare Bengaluru Karnataka 165578
|
||||
* *Signature*: uploads/gauravguitarrocks/202944822449057/4791133489169827307/4791133489169827307_signature_4.png""".strip()
|
||||
|
||||
self.check_webhook(
|
||||
"response",
|
||||
|
|
|
@ -24,7 +24,9 @@ def api_jotform_webhook(
|
|||
|
||||
form_response = f"A new submission (ID {submission_id}) was received:\n"
|
||||
for field in fields:
|
||||
form_response += f"* {field}\n"
|
||||
label, value = field.split(":", 1)
|
||||
separator = " " if label.endswith("?") else ": "
|
||||
form_response += f"* *{label}*{separator}{value}\n"
|
||||
|
||||
message = form_response.strip()
|
||||
|
||||
|
|
Loading…
Reference in New Issue