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
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:
0
zerver/webhooks/wekan/__init__.py
Normal file
0
zerver/webhooks/wekan/__init__.py
Normal file
23
zerver/webhooks/wekan/doc.md
Normal file
23
zerver/webhooks/wekan/doc.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Zulip Wekan integration
|
||||
|
||||
Get Wekan notifications in Zulip!
|
||||
|
||||
{start_tabs}
|
||||
|
||||
1. {!create-an-incoming-webhook.md!}
|
||||
|
||||
1. {!generate-webhook-url-basic.md!}
|
||||
|
||||
1. Go to Wekan, click the **Settings** icon, and select **Outgoing Webhooks**.
|
||||
|
||||
1. Set **URL** to the URL generated above, and click **Add Webhook**.
|
||||
|
||||
{end_tabs}
|
||||
|
||||
{!congrats.md!}
|
||||
|
||||

|
||||
|
||||
### Related documentation
|
||||
|
||||
{!webhooks-url-specification.md!}
|
||||
8
zerver/webhooks/wekan/fixtures/add_attachment.json
Normal file
8
zerver/webhooks/wekan/fixtures/add_attachment.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish added attachment \"hGfm5ksud8k\" to card \"Markdown and emoji's\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-addAttachment"
|
||||
}
|
||||
8
zerver/webhooks/wekan/fixtures/add_checklist.json
Normal file
8
zerver/webhooks/wekan/fixtures/add_checklist.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish added checklist \"To do\" to card \"Markdown and emoji's\" at list \"Design\" at swimlane \"Default\" at board \"bucked-list\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-addChecklist"
|
||||
}
|
||||
8
zerver/webhooks/wekan/fixtures/add_checklist_item.json
Normal file
8
zerver/webhooks/wekan/fixtures/add_checklist_item.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish added checklist item \"merge commit 9dfe\" to checklist \"To do\" at card \"Markdown and emoji's\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-addChecklistItem"
|
||||
}
|
||||
10
zerver/webhooks/wekan/fixtures/add_comment.json
Normal file
10
zerver/webhooks/wekan/fixtures/add_comment.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"text": "JohnFish commented on card \"Markdown and emoji's\": \"This feature is important\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"comment": "This feature is important",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"commentId": "tNko8hJZvMudkX4pt",
|
||||
"description": "act-addComment"
|
||||
}
|
||||
10
zerver/webhooks/wekan/fixtures/add_label.json
Normal file
10
zerver/webhooks/wekan/fixtures/add_label.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"text": "JohnFish Added label Language to card \"Markdown & emojis\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/TMmjFnQGuZPsbjXzS",
|
||||
"cardId": "TMmjFnQGuZPsbjXzS",
|
||||
"listId": "m6ZKFcprEbX6hmFGy",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown & emojis",
|
||||
"swimlaneId": "9KQqj2M37hztEr68d",
|
||||
"description": "act-addedLabel"
|
||||
}
|
||||
10
zerver/webhooks/wekan/fixtures/archived_card.json
Normal file
10
zerver/webhooks/wekan/fixtures/archived_card.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"text": "JohnFish Card \"Markdown and emoji's\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\" moved to Archive\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"listId": "m6ZKFcprEbX6hmFGy",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"swimlaneId": "QxJLobhCKvgwvy4vu",
|
||||
"description": "act-archivedCard"
|
||||
}
|
||||
7
zerver/webhooks/wekan/fixtures/archived_list.json
Normal file
7
zerver/webhooks/wekan/fixtures/archived_list.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"text": "JohnFish List \"Design\" at swimlane \"Default\" at board \"Bucket List\" moved to Archive\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list",
|
||||
"listId": "BB7dtJSo4zB5QBzhY",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"description": "act-archivedList"
|
||||
}
|
||||
7
zerver/webhooks/wekan/fixtures/archived_swimlane.json
Normal file
7
zerver/webhooks/wekan/fixtures/archived_swimlane.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"text": "JohnFish Swimlane \"Default\" at board \"Bucket List\" moved to Archive\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"swimlaneId": "QxJLobhCKvgwvy4vu",
|
||||
"description": "act-archivedSwimlane"
|
||||
}
|
||||
8
zerver/webhooks/wekan/fixtures/checked_item.json
Normal file
8
zerver/webhooks/wekan/fixtures/checked_item.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish checked To do of checklist \"To do\" at card \"Markdown and emoji's\" at list \"Design\" at swimlane \"Default\" at board \"bucket-list\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-checkedItem"
|
||||
}
|
||||
10
zerver/webhooks/wekan/fixtures/create_card.json
Normal file
10
zerver/webhooks/wekan/fixtures/create_card.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"text": "JohnFish created card \"Markdown and emoji's\" to list \"Development & Implementation\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"listId": "BB7dtJSo4zB5QBzhY",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"swimlaneId": "QxJLobhCKvgwvy4vu",
|
||||
"description": "act-createCard"
|
||||
}
|
||||
6
zerver/webhooks/wekan/fixtures/create_custom_field.json
Normal file
6
zerver/webhooks/wekan/fixtures/create_custom_field.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"text": "JohnFish created custom field Language at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"description": "act-createCustomField"
|
||||
}
|
||||
7
zerver/webhooks/wekan/fixtures/create_list.json
Normal file
7
zerver/webhooks/wekan/fixtures/create_list.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"text": "JohnFish added list \"Testing & Maintenance\" to board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list",
|
||||
"listId": "ygpBp4a94TcwTSXP9",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"description": "act-createList"
|
||||
}
|
||||
7
zerver/webhooks/wekan/fixtures/create_swimlane.json
Normal file
7
zerver/webhooks/wekan/fixtures/create_swimlane.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"text": "JohnFish created swimlane \"Jasper\" to board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"swimlaneId": "ZDyaRSF83EWkkeK5Y",
|
||||
"description": "act-createSwimlane"
|
||||
}
|
||||
8
zerver/webhooks/wekan/fixtures/delete_attachment.json
Normal file
8
zerver/webhooks/wekan/fixtures/delete_attachment.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish deleted attachment \"hGfm5ksud8k.jpg\" at card \"Markdown and emoji's\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-deleteAttachment"
|
||||
}
|
||||
10
zerver/webhooks/wekan/fixtures/join_member.json
Normal file
10
zerver/webhooks/wekan/fixtures/join_member.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"text": "JohnFish added member kokoboss to card \"Markdown & emojis\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/TMmjFnQGuZPsbjXzS",
|
||||
"cardId": "TMmjFnQGuZPsbjXzS",
|
||||
"listId": "m6ZKFcprEbX6hmFGy",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown & emojis",
|
||||
"swimlaneId": "9KQqj2M37hztEr68d",
|
||||
"description": "act-joinMember"
|
||||
}
|
||||
11
zerver/webhooks/wekan/fixtures/move_card.json
Normal file
11
zerver/webhooks/wekan/fixtures/move_card.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"text": "JohnFish moved card \"Markdown and emoji's\" at board \"Bucket List\" from list \"Development & Implementation\" at swimlane \"Default\" to list \"Design\" at swimlane \"Default\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"listId": "m6ZKFcprEbX6hmFGy",
|
||||
"oldListId": "BB7dtJSo4zB5QBzhY",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"swimlaneId": "QxJLobhCKvgwvy4vu",
|
||||
"description": "act-moveCard"
|
||||
}
|
||||
7
zerver/webhooks/wekan/fixtures/remove_list.json
Normal file
7
zerver/webhooks/wekan/fixtures/remove_list.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"text": "JohnFish act-removeList\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list",
|
||||
"listId": "ksHcqWxZjN6RLEnxd",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"description": "act-removeList"
|
||||
}
|
||||
7
zerver/webhooks/wekan/fixtures/remove_swimlane.json
Normal file
7
zerver/webhooks/wekan/fixtures/remove_swimlane.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"text": "JohnFish act-removeSwimlane\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"swimlaneId": "QxJLobhCKvgwvy4vu",
|
||||
"description": "act-removeSwimlane"
|
||||
}
|
||||
8
zerver/webhooks/wekan/fixtures/removed_checklist.json
Normal file
8
zerver/webhooks/wekan/fixtures/removed_checklist.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish removed checklist \"To do\" from card \"Markdown and emoji's\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-removeChecklist"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish act-removedChecklistItem\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-removedChecklistItem"
|
||||
}
|
||||
10
zerver/webhooks/wekan/fixtures/restored_card.json
Normal file
10
zerver/webhooks/wekan/fixtures/restored_card.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"text": "JohnFish restored card \"Markdown and emoji's\" to list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"listId": "m6ZKFcprEbX6hmFGy",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"swimlaneId": "QxJLobhCKvgwvy4vu",
|
||||
"description": "act-restoredCard"
|
||||
}
|
||||
8
zerver/webhooks/wekan/fixtures/set_custom_field.json
Normal file
8
zerver/webhooks/wekan/fixtures/set_custom_field.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish act-setCustomField\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-setCustomField"
|
||||
}
|
||||
8
zerver/webhooks/wekan/fixtures/uncomplete_checklist.json
Normal file
8
zerver/webhooks/wekan/fixtures/uncomplete_checklist.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"text": "JohnFish uncompleted checklist To do at card \"Markdown and emoji's\" at list \"Design\" at swimlane \"Default\" at board \"Bucket List\"\nhttp://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL",
|
||||
"cardId": "pMtu7kPZvMuhhC4hL",
|
||||
"boardId": "Jinj4Xj7qnHLRmrTY",
|
||||
"user": "JohnFish",
|
||||
"card": "Markdown and emoji's",
|
||||
"description": "act-uncompleteChecklist"
|
||||
}
|
||||
216
zerver/webhooks/wekan/tests.py
Normal file
216
zerver/webhooks/wekan/tests.py
Normal file
@@ -0,0 +1,216 @@
|
||||
from typing_extensions import override
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class WekanHookTests(WebhookTestCase):
|
||||
def test_add_attachment_message(self) -> None:
|
||||
expected_message = 'JohnFish added attachment "hGfm5ksud8k" to card "Markdown and emoji\'s" at list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"add_attachment",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_add_checklist_item_message(self) -> None:
|
||||
expected_message = 'JohnFish added checklist item "merge commit 9dfe" to checklist "To do" at card "Markdown and emoji\'s" at list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"add_checklist_item",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_add_checklist_message(self) -> None:
|
||||
expected_message = 'JohnFish added checklist "To do" to card "Markdown and emoji\'s" at list "Design" at swimlane "Default" at board "bucked-list".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"add_checklist",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_add_label_message(self) -> None:
|
||||
expected_message = 'JohnFish Added label Language to card "Markdown & emojis" at list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/TMmjFnQGuZPsbjXzS)'
|
||||
self.check_webhook(
|
||||
"add_label",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_archived_swimlane_message(self) -> None:
|
||||
expected_message = 'JohnFish Swimlane "Default" at board "Bucket List" moved to Archive.\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list)'
|
||||
self.check_webhook(
|
||||
"archived_swimlane",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_archived_card_message(self) -> None:
|
||||
expected_message = 'JohnFish Card "Markdown and emoji\'s" at list "Design" at swimlane "Default" at board "Bucket List" moved to Archive.\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"archived_card",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_archived_list_message(self) -> None:
|
||||
expected_message = 'JohnFish List "Design" at swimlane "Default" at board "Bucket List" moved to Archive.\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list)'
|
||||
self.check_webhook(
|
||||
"archived_list",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_checked_item_message(self) -> None:
|
||||
expected_message = 'JohnFish checked To do of checklist "To do" at card "Markdown and emoji\'s" at list "Design" at swimlane "Default" at board "bucket-list".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"checked_item",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_add_comment_message(self) -> None:
|
||||
expected_message = 'JohnFish commented on card "Markdown and emoji\'s": "This feature is important" at list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"add_comment",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_create_card_message(self) -> None:
|
||||
expected_message = 'JohnFish created card "Markdown and emoji\'s" to list "Development & Implementation" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"create_card",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_create_custom_field_message(self) -> None:
|
||||
expected_message = 'JohnFish created custom field Language at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list)'
|
||||
self.check_webhook(
|
||||
"create_custom_field",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_create_list_message(self) -> None:
|
||||
expected_message = 'JohnFish added list "Testing & Maintenance" to board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list)'
|
||||
self.check_webhook(
|
||||
"create_list",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_create_swimlane_message(self) -> None:
|
||||
expected_message = 'JohnFish created swimlane "Jasper" to board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list)'
|
||||
self.check_webhook(
|
||||
"create_swimlane",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_delete_attachment_message(self) -> None:
|
||||
expected_message = 'JohnFish deleted attachment "hGfm5ksud8k.jpg" at card "Markdown and emoji\'s" at list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"delete_attachment",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_join_member_message(self) -> None:
|
||||
expected_message = 'JohnFish added member kokoboss to card "Markdown & emojis" at list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/TMmjFnQGuZPsbjXzS)'
|
||||
self.check_webhook(
|
||||
"join_member",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_move_card_message(self) -> None:
|
||||
expected_message = 'JohnFish moved card "Markdown and emoji\'s" at board "Bucket List" from list "Development & Implementation" at swimlane "Default" to list "Design" at swimlane "Default".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"move_card",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_remove_list_message(self) -> None:
|
||||
expected_message = "JohnFish act-removeList.\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list)"
|
||||
self.check_webhook(
|
||||
"remove_list",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_remove_swimlane_message(self) -> None:
|
||||
expected_message = "JohnFish act-removeSwimlane.\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list)"
|
||||
self.check_webhook(
|
||||
"remove_swimlane",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_removed_checklist_item_message(self) -> None:
|
||||
expected_message = "JohnFish act-removedChecklistItem.\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)"
|
||||
self.check_webhook(
|
||||
"removed_checklist_item",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_removed_checklist_message(self) -> None:
|
||||
expected_message = 'JohnFish removed checklist "To do" from card "Markdown and emoji\'s" at list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"removed_checklist",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_restored_card_message(self) -> None:
|
||||
expected_message = 'JohnFish restored card "Markdown and emoji\'s" to list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"restored_card",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_set_custom_field_message(self) -> None:
|
||||
expected_message = "JohnFish act-setCustomField.\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)"
|
||||
self.check_webhook(
|
||||
"set_custom_field",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
def test_uncomplete_checklist_message(self) -> None:
|
||||
expected_message = 'JohnFish uncompleted checklist To do at card "Markdown and emoji\'s" at list "Design" at swimlane "Default" at board "Bucket List".\n\n[See in Wekan](http://127.0.0.1/b/Jinj4Xj7qnHLRmrTY/bucket-list/pMtu7kPZvMuhhC4hL)'
|
||||
self.check_webhook(
|
||||
"uncomplete_checklist",
|
||||
"Wekan Notification",
|
||||
expected_message,
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
||||
@override
|
||||
def get_body(self, fixture_name: str) -> str:
|
||||
return self.webhook_fixture_data("wekan", fixture_name, file_type="json")
|
||||
50
zerver/webhooks/wekan/view.py
Normal file
50
zerver/webhooks/wekan/view.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import webhook_view
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.typed_endpoint import JsonBodyPayload, typed_endpoint
|
||||
from zerver.lib.validator import WildValue, check_string
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
LINK_TEMPLATE = "[See in Wekan]({url})"
|
||||
MESSAGE_TEMPLATE = "{body}\n\n{footer}"
|
||||
|
||||
|
||||
def get_url(text: str) -> str:
|
||||
return text.rsplit("\n", 1)[-1]
|
||||
|
||||
|
||||
def get_hyperlinked_url(text: str) -> str:
|
||||
url = get_url(text)
|
||||
return LINK_TEMPLATE.format(url=url)
|
||||
|
||||
|
||||
def clean_payload_text(text: str) -> str:
|
||||
url = get_url(text)
|
||||
return text.replace(url, "").replace("\n", "")
|
||||
|
||||
|
||||
def get_message_body(payload: WildValue) -> str:
|
||||
footer = get_hyperlinked_url(payload["text"].tame(check_string))
|
||||
body = process_message_data(payload)
|
||||
return MESSAGE_TEMPLATE.format(body=body, footer=footer)
|
||||
|
||||
|
||||
def process_message_data(payload: WildValue) -> str:
|
||||
text = clean_payload_text(payload["text"].tame(check_string))
|
||||
return f"{text}."
|
||||
|
||||
|
||||
@webhook_view("Wekan")
|
||||
@typed_endpoint
|
||||
def api_wekan_webhook(
|
||||
request: HttpRequest,
|
||||
user_profile: UserProfile,
|
||||
*,
|
||||
payload: JsonBodyPayload[WildValue],
|
||||
) -> HttpResponse:
|
||||
topic_name = "Wekan Notification"
|
||||
body = get_message_body(payload)
|
||||
check_send_webhook_message(request, user_profile, topic_name, body)
|
||||
return json_success(request)
|
||||
Reference in New Issue
Block a user