mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
webhooks: Make github webhook support event filtering system.
This commit is contained in:
@@ -18,6 +18,7 @@ class GitHubWebhookTest(WebhookTestCase):
|
||||
STREAM_NAME = "github"
|
||||
URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"
|
||||
WEBHOOK_DIR_NAME = "github"
|
||||
VIEW_FUNCTION_NAME = "api_github_webhook"
|
||||
|
||||
def test_ping_event(self) -> None:
|
||||
expected_message = "GitHub webhook has been successfully configured by TomaszKolek."
|
||||
|
||||
@@ -672,8 +672,10 @@ IGNORED_TEAM_ACTIONS = [
|
||||
"removed_from_repository",
|
||||
]
|
||||
|
||||
ALL_EVENT_TYPES = list(EVENT_FUNCTION_MAPPER.keys())
|
||||
|
||||
@webhook_view("GitHub", notify_bot_owner_on_invalid_json=True)
|
||||
|
||||
@webhook_view("GitHub", notify_bot_owner_on_invalid_json=True, all_event_types=ALL_EVENT_TYPES)
|
||||
@has_request_variables
|
||||
def api_github_webhook(
|
||||
request: HttpRequest,
|
||||
@@ -709,7 +711,7 @@ def api_github_webhook(
|
||||
)
|
||||
body = body_function(helper)
|
||||
|
||||
check_send_webhook_message(request, user_profile, subject, body)
|
||||
check_send_webhook_message(request, user_profile, subject, body, event)
|
||||
return json_success()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user