mirror of https://github.com/zulip/zulip.git
webhooks: Make github webhook support event filtering system.
This commit is contained in:
parent
309f4ba145
commit
e373df88e0
|
@ -18,6 +18,7 @@ class GitHubWebhookTest(WebhookTestCase):
|
||||||
STREAM_NAME = "github"
|
STREAM_NAME = "github"
|
||||||
URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"
|
URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"
|
||||||
WEBHOOK_DIR_NAME = "github"
|
WEBHOOK_DIR_NAME = "github"
|
||||||
|
VIEW_FUNCTION_NAME = "api_github_webhook"
|
||||||
|
|
||||||
def test_ping_event(self) -> None:
|
def test_ping_event(self) -> None:
|
||||||
expected_message = "GitHub webhook has been successfully configured by TomaszKolek."
|
expected_message = "GitHub webhook has been successfully configured by TomaszKolek."
|
||||||
|
|
|
@ -672,8 +672,10 @@ IGNORED_TEAM_ACTIONS = [
|
||||||
"removed_from_repository",
|
"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
|
@has_request_variables
|
||||||
def api_github_webhook(
|
def api_github_webhook(
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
|
@ -709,7 +711,7 @@ def api_github_webhook(
|
||||||
)
|
)
|
||||||
body = body_function(helper)
|
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()
|
return json_success()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue