mirror of https://github.com/zulip/zulip.git
slack_incoming: Handle explicit None text payload in webhook.
This commit is contained in:
parent
84e8d9ce98
commit
43f3f9221d
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"text": null
|
||||||
|
}
|
|
@ -18,6 +18,12 @@ Hello, world.
|
||||||
expected_message,
|
expected_message,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_null_message(self) -> None:
|
||||||
|
self.check_webhook(
|
||||||
|
"null_text",
|
||||||
|
expect_noop=True,
|
||||||
|
)
|
||||||
|
|
||||||
def test_message_as_www_urlencoded(self) -> None:
|
def test_message_as_www_urlencoded(self) -> None:
|
||||||
expected_topic = "devops"
|
expected_topic = "devops"
|
||||||
expected_message = """
|
expected_message = """
|
||||||
|
|
|
@ -50,7 +50,7 @@ def api_slack_incoming_webhook(
|
||||||
for attachment in payload["attachments"]:
|
for attachment in payload["attachments"]:
|
||||||
body = add_attachment(attachment, body)
|
body = add_attachment(attachment, body)
|
||||||
|
|
||||||
if body == "" and "text" in payload:
|
if body == "" and "text" in payload and payload["text"] is not None:
|
||||||
body += payload["text"]
|
body += payload["text"]
|
||||||
if "icon_emoji" in payload and payload["icon_emoji"] is not None:
|
if "icon_emoji" in payload and payload["icon_emoji"] is not None:
|
||||||
body = "{} {}".format(payload["icon_emoji"], body)
|
body = "{} {}".format(payload["icon_emoji"], body)
|
||||||
|
|
Loading…
Reference in New Issue