Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks/github: Add include_emoji parameter for notifications.
Pritesh Shetty6756c197bb74
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.pyindex 6ffb7a7e981..5cfc7e7ca53 100644--- a/zerver/lib/integrations.py+++ b/zerver/lib/integrations.py@@ -673,6 +673,11 @@ INCOMING_WEBHOOK_INTEGRATIONS: list[IncomingWebhookIntegration] = [label="Include repository name in the notifications",input_type="checkbox",),+ WebhookUrlOption(+ name="include_emoji_indicators",+ label="Include emoji indicators in the notifications",+ input_type="checkbox_enabled",+ ),],),IncomingWebhookIntegration(diff --git a/zerver/webhooks/github/doc.md b/zerver/webhooks/github/doc.mdindex c91441e1d81..6b242140095 100644--- a/zerver/webhooks/github/doc.md+++ b/zerver/webhooks/github/doc.md@@ -16,9 +16,12 @@ Get GitHub notifications in Zulip!1. Decide where to send {{ integration_display_name }} notifications, and[generate the integration URL](/help/generate-integration-url). You'll be- able to configure which branches you'll receive notifications from,- whether to exclude notifications from private repositories, and whether- to include the repository name in the notifications.+ able to configure:+ - Which branches you'll receive notifications from.+ - Whether to exclude notifications from private repositories.+ - Whether to include the repository name in the notifications.+ - Whether to include emoji indicators in the notifications.+1. On your repository's web page, go to **Settings**. Select **Webhooks**,and click **Add webhook**. GitHub may prompt you for your password.diff --git a/zerver/webhooks/github/view.py b/zerver/webhooks/github/view.pyindex a3bbf894766..ae0f9ebf2c2 100644--- a/zerver/webhooks/github/view.py+++ b/zerver/webhooks/github/view.py@@ -67,12 +67,14 @@ class Helper:payload: WildValue,include_title: bool,include_repository_name: bool,+ include_emoji_indicators: bool,user_profile: UserProfile,) -> None:self.request = requestself.payload = payloadself.include_title = include_titleself.include_repository_name = include_repository_name+ self.include_emoji_indicators = include_emoji_indicatorsself.realm = user_profile.realmdef log_unsupported(self, event: str) -> None:@@ -1150,6 +1152,7 @@ def api_github_webhook(user_specified_topic: OptionalUserSpecifiedTopicStr = None,ignore_private_repositories: Json[bool] = False,include_repository_name: Json[bool] = False,+ include_emoji_indicators: Json[bool] = True,) -> HttpResponse:"""GitHub sends the event as an HTTP header. We have our@@ -1194,6 +1197,7 @@ def api_github_webhook(payload=payload,include_title=user_specified_topic is not None,include_repository_name=include_repository_name,+ include_emoji_indicators=include_emoji_indicators,user_profile=user_profile,)body = body_function(helper)