snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-15 15:05:30 +05:00
commit 64898b2c79
8999 changed files with 1757358 additions and 0 deletions

View File

View File

@@ -0,0 +1,39 @@
# Zulip Redmine integration
Get notifications for Redmine issues in Zulip!
{start_tabs}
1. {!create-an-incoming-webhook.md!}
1. {!generate-webhook-url-basic.md!}
1. Install the [`redmine_webhook` plugin](https://github.com/suer/redmine_webhook)
on your Redmine server.
1. In your Redmine installation, go to **Projects** and select the project
you want to receive notifications for.
1. From the project page, enable the **Webhooks** checkbox to
activate webhook functionality. Click on **Settings**, and navigate to
the **WebHook** tab.
1. Add the URL generated above, select the
[events](#filtering-incoming-events) you would like to receive
notifications for, and save your webhook configuration.
{end_tabs}
{!congrats.md!}
![](/static/images/integrations/redmine/001.png)
{!event-filtering-additional-feature.md!}
### Related documentation
- [`redmine_webhook` plugin](https://github.com/suer/redmine_webhook)
- [Redmine's plugin installation guide](https://www.redmine.org/projects/redmine/wiki/Plugins)
{!webhooks-url-specification.md!}

View File

@@ -0,0 +1,60 @@
{
"payload": {
"issue": {
"author": {
"icon_url": "http://www.gravatar.com/avatar/example",
"identity_url": null,
"lastname": "user",
"firstname": "test",
"mail": "test@example.com",
"login": "test",
"id": 3
},
"assignee": {
"icon_url": "http://www.gravatar.com/avatar/example",
"identity_url": null,
"lastname": "user",
"firstname": "test",
"mail": "test@example.com",
"login": "test",
"id": 3
},
"priority": {
"name": "normal",
"id": 2
},
"tracker": {
"name": "bug",
"id": 1
},
"parent_id": null,
"root_id": 191,
"closed_on": null,
"updated_on": "2014-03-01T15:17:48Z",
"created_on": "2014-03-01T15:17:48Z",
"description": "I'm having a problem with this.",
"subject": "Found a bug",
"id": 191,
"done_ratio": 0,
"start_date": "2014-03-02",
"due_date": null,
"estimated_hours": null,
"is_private": false,
"lock_version": 0,
"project": {
"homepage": "",
"created_on": "2013-01-12T11:50:26Z",
"description": "",
"name": "Test Project",
"identifier": "test",
"id": 4
},
"status": {
"name": "new",
"id": 1
}
},
"action": "opened",
"url": "https://example.com"
}
}

View File

@@ -0,0 +1,52 @@
{
"payload": {
"issue": {
"author": {
"icon_url": "http://www.gravatar.com/avatar/example",
"identity_url": null,
"lastname": "user",
"firstname": "test",
"mail": "test@example.com",
"login": "test",
"id": 3
},
"assignee": null,
"priority": {
"name": "normal",
"id": 2
},
"tracker": {
"name": "bug",
"id": 1
},
"parent_id": null,
"root_id": 191,
"closed_on": null,
"updated_on": "2014-03-01T15:17:48Z",
"created_on": "2014-03-01T15:17:48Z",
"description": "I'm having a problem with this.",
"subject": "Found a bug",
"id": 191,
"done_ratio": 0,
"start_date": "2014-03-02",
"due_date": null,
"estimated_hours": null,
"is_private": false,
"lock_version": 0,
"project": {
"homepage": "",
"created_on": "2013-01-12T11:50:26Z",
"description": "",
"name": "Test Project",
"identifier": "test",
"id": 4
},
"status": {
"name": "new",
"id": 1
}
},
"action": "opened",
"url": "https://example.com"
}
}

View File

@@ -0,0 +1,74 @@
{
"payload": {
"issue": {
"author": {
"icon_url": "http://www.gravatar.com/avatar/example",
"identity_url": null,
"lastname": "user",
"firstname": "test",
"mail": "test@example.com",
"login": "test",
"id": 3
},
"assignee": {
"icon_url": "http://www.gravatar.com/avatar/example",
"identity_url": null,
"lastname": "user",
"firstname": "test",
"mail": "test@example.com",
"login": "test",
"id": 3
},
"priority": {
"name": "normal",
"id": 2
},
"tracker": {
"name": "bug",
"id": 1
},
"parent_id": null,
"root_id": 191,
"closed_on": null,
"updated_on": "2014-03-01T16:17:48Z",
"created_on": "2014-03-01T15:17:48Z",
"description": "I'm having a problem with this.",
"subject": "Found a bug",
"id": 191,
"done_ratio": 0,
"start_date": "2014-03-02",
"due_date": null,
"estimated_hours": null,
"is_private": false,
"lock_version": 1,
"project": {
"homepage": "",
"created_on": "2013-01-12T11:50:26Z",
"description": "",
"name": "Test Project",
"identifier": "test",
"id": 4
},
"status": {
"name": "in progress",
"id": 2
}
},
"journal": {
"notes": "I've started working on this issue. The problem seems to be in the authentication module.",
"author": {
"icon_url": "http://www.gravatar.com/avatar/example",
"identity_url": null,
"lastname": "user2",
"firstname": "test2",
"mail": "test2@example.com",
"login": "test2",
"id": 3
},
"created_on": "2014-03-01T16:17:48Z",
"id": 1
},
"action": "updated",
"url": "https://example.com"
}
}

View File

@@ -0,0 +1,32 @@
from zerver.lib.test_classes import WebhookTestCase
class RedmineHookTests(WebhookTestCase):
CHANNEL_NAME = "redmine"
URL_TEMPLATE = "/api/v1/external/redmine?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "redmine"
TOPIC_NAME = "Issue #191 Found a bug"
def test_issue_opened(self) -> None:
expected_message = """**test user** opened [#191 Found a bug](https://example.com) for **test user**.
~~~ quote
I'm having a problem with this.
~~~"""
self.check_webhook("issue_opened", self.TOPIC_NAME, expected_message)
def test_issue_opened_without_assignee(self) -> None:
expected_message = """**test user** opened [#191 Found a bug](https://example.com).
~~~ quote
I'm having a problem with this.
~~~"""
self.check_webhook("issue_opened_without_assignee", self.TOPIC_NAME, expected_message)
def test_issue_updated(self) -> None:
expected_message = """**test2 user2** updated [#191 Found a bug](https://example.com).
~~~ quote
I've started working on this issue. The problem seems to be in the authentication module.
~~~"""
self.check_webhook("issue_updated", self.TOPIC_NAME, expected_message)

View File

@@ -0,0 +1,112 @@
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventTypeError
from zerver.lib.response import json_success
from zerver.lib.typed_endpoint import JsonBodyPayload, typed_endpoint
from zerver.lib.validator import WildValue, check_int, check_string
from zerver.lib.webhooks.common import check_send_webhook_message
from zerver.models import UserProfile
ISSUE_OPENED_MESSAGE_TEMPLATE = (
"**{author_name}** opened {issue_link}{assignee_info}.{issue_description}"
)
ISSUE_UPDATED_MESSAGE_TEMPLATE = "**{author_name}** updated {issue_link}.{journal_notes}"
CONTENT_MESSAGE_TEMPLATE = "\n\n~~~ quote\n{message}\n~~~"
def _extract_issue_label(issue: WildValue) -> str:
id = issue["id"].tame(check_int)
subject = issue["subject"].tame(check_string)
return f"#{id} {subject}"
def get_issue_topic(payload: WildValue) -> str:
issue_label = _extract_issue_label(payload["issue"])
return f"Issue {issue_label}"
def _get_issue_link(payload: WildValue) -> str:
url = payload["url"].tame(check_string)
issue = payload["issue"]
issue_label = _extract_issue_label(issue)
return f"[{issue_label}]({url})"
def _get_user_name(user: WildValue) -> str:
return f"{user['firstname'].tame(check_string)} {user['lastname'].tame(check_string)}"
def _get_assignee_string(issue: WildValue) -> str:
if assignee := issue.get("assignee"):
assignee_name = _get_user_name(assignee)
return f" for **{assignee_name}**"
return ""
def handle_issue_opened(payload: WildValue) -> str:
issue = payload["issue"]
author_name = _get_user_name(issue["author"])
issue_link = _get_issue_link(payload)
assignee_info = _get_assignee_string(issue)
issue_description = ""
if issue.get("description") and (
description := issue["description"].tame(check_string).strip()
):
issue_description = CONTENT_MESSAGE_TEMPLATE.format(message=description)
return ISSUE_OPENED_MESSAGE_TEMPLATE.format(
author_name=author_name,
issue_link=issue_link,
assignee_info=assignee_info,
issue_description=issue_description,
)
def handle_issue_updated(payload: WildValue) -> str:
author_name = _get_user_name(payload["journal"]["author"])
issue_link = _get_issue_link(payload)
journal_notes = ""
if (
(journal := payload.get("journal"))
and (notes := journal.get("notes"))
and (tamed_notes := notes.tame(check_string).strip())
):
journal_notes = CONTENT_MESSAGE_TEMPLATE.format(message=tamed_notes)
return ISSUE_UPDATED_MESSAGE_TEMPLATE.format(
author_name=author_name,
issue_link=issue_link,
journal_notes=journal_notes,
)
REDMINE_EVENT_FUNCTION_MAPPER = {
"opened": handle_issue_opened,
"updated": handle_issue_updated,
}
ALL_EVENT_TYPES = list(REDMINE_EVENT_FUNCTION_MAPPER.keys())
@webhook_view("Redmine", notify_bot_owner_on_invalid_json=True, all_event_types=ALL_EVENT_TYPES)
@typed_endpoint
def api_redmine_webhook(
request: HttpRequest, user_profile: UserProfile, *, payload: JsonBodyPayload[WildValue]
) -> HttpResponse:
redmine_payload = payload["payload"]
event = redmine_payload["action"].tame(check_string)
if event not in REDMINE_EVENT_FUNCTION_MAPPER:
raise UnsupportedWebhookEventTypeError(event)
topic_name = get_issue_topic(redmine_payload)
content_func = REDMINE_EVENT_FUNCTION_MAPPER[event]
content = content_func(redmine_payload)
check_send_webhook_message(request, user_profile, topic_name, content)
return json_success(request)