From bacfadbc618e500ac8daf6ab0cc17b2641c25e40 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Fri, 27 Mar 2020 20:50:56 +0000 Subject: [PATCH] minor: Use explicit params in build_bot_request. I also tweaked the block comment to mention gravatars. --- zerver/lib/outgoing_webhook.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/zerver/lib/outgoing_webhook.py b/zerver/lib/outgoing_webhook.py index 998e5bc3ad..608abf099e 100644 --- a/zerver/lib/outgoing_webhook.py +++ b/zerver/lib/outgoing_webhook.py @@ -28,12 +28,21 @@ class OutgoingWebhookServiceInterface: class GenericOutgoingWebhookService(OutgoingWebhookServiceInterface): def build_bot_request(self, event: Dict[str, Any]) -> Optional[Any]: - # Because we don't have a place for the recipient of an - # outgoing webhook to indicate whether it wants the raw - # Markdown or the rendered HTML, we leave both the content and - # rendered_content fields in the message payload. - MessageDict.finalize_payload(event['message'], False, False, - keep_rendered_content=True) + ''' + We send a simple version of the message to outgoing + webhooks, since most of them really only need + `content` and a few other fields. We may eventually + allow certain bots to get more information, but + that's not a high priority. We do send the gravatar + info to the clients (so they don't have to compute + it themselves). + ''' + MessageDict.finalize_payload( + event['message'], + apply_markdown=False, + client_gravatar=False, + keep_rendered_content=True + ) request_data = {"data": event['command'], "message": event['message'],