webhooks: Add support for GitHub discussions messages.

We aim to use Zulip topics thoughtfully in displaying messages from
discussions, as well as linking to the discussion in every message so
that it's easy to view them.

Fixes #19938.
This commit is contained in:
Shlok Patel
2021-10-18 17:03:38 +05:30
committed by Tim Abbott
parent 9381a3bd45
commit 0678e2610f
4 changed files with 441 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ TOPIC_DEPLOYMENT = "public-repo / Deployment on production"
TOPIC_ORGANIZATION = "baxterandthehackers organization"
TOPIC_BRANCH = "public-repo / changes"
TOPIC_WIKI = "public-repo / wiki pages"
TOPIC_DISCUSSION = "public-repo discussion #90: Welcome to discussions!"
class GitHubWebhookTest(WebhookTestCase):
@@ -483,3 +484,11 @@ A temporary team so that I can get some webhook fixtures!
msg,
)
self.assertTrue(stack_info)
def test_discussion_msg(self) -> None:
expected_message = "Codertocat started a new discussion [Welcome to discussions!](https://github.com/baxterthehacker/public-repo/discussions/90) in General:\n```quote\nWe're glad to have you here!\n```"
self.check_webhook("discussion", TOPIC_DISCUSSION, expected_message)
def test_discussion_comment_msg(self) -> None:
expected_message = "Codertocat [commented](https://github.com/baxterthehacker/public-repo/discussions/90#discussioncomment-544078) on [discussion](https://github.com/baxterthehacker/public-repo/discussions/90):\n```quote\nI have so many questions to ask you!\n```"
self.check_webhook("discussion_comment", TOPIC_DISCUSSION, expected_message)