Skip to content

feat(events): make card, ACL and board events webhook-compatible#7910

Draft
cbcoutinho wants to merge 1 commit intonextcloud:mainfrom
cbcoutinho:feat/webhook-compatible-events
Draft

feat(events): make card, ACL and board events webhook-compatible#7910
cbcoutinho wants to merge 1 commit intonextcloud:mainfrom
cbcoutinho:feat/webhook-compatible-events

Conversation

@cbcoutinho
Copy link
Copy Markdown

Summary

Implements OCP\EventDispatcher\IWebhookCompatibleEvent on Deck's event base classes so the webhook_listeners app (added in NC 30) can serialize and deliver them. Today Deck dispatches plain OCP\EventDispatcher\Event instances, so the listener has nothing to serialize and Deck cannot drive any webhook automation.

This is the path the maintainer suggested in #3341 (use flow_webhooks rather than building a webhook system inside Deck). With this change in place, an admin can register listeners for OCA\Deck\Event\CardCreatedEvent, CardUpdatedEvent, CardDeletedEvent, BoardUpdatedEvent, and the ACL events directly through the existing webhook UI.

Changes

File Change
lib/Event/ACardEvent.php implements IWebhookCompatibleEventgetWebhookSerializable() returns ['card' => $card->jsonSerialize()] (covers CardCreatedEvent, CardUpdatedEvent, CardDeletedEvent)
lib/Event/AAclEvent.php implements IWebhookCompatibleEventgetWebhookSerializable() returns ['acl' => $acl->jsonSerialize()]. The existing Acl::jsonSerialize() already strips token, so it is not exposed via webhooks
lib/Event/BoardUpdatedEvent.php implements IWebhookCompatibleEvent — returns ['boardId' => $boardId] (the event only carries the id today; receivers can fetch detail via API if needed)
tests/unit/Event/WebhookCompatibleEventsTest.php New unit tests asserting interface conformance and payload shape for CardCreatedEvent, AclCreatedEvent, and BoardUpdatedEvent

The shape ({"<entity>": …}) follows the convention used by core OCP events such as OCP\Files\Events\Node\AbstractNodeEvent and OCP\SystemTag\TagAssignedEvent.

Compatibility

appinfo/info.xml requires nextcloud min-version="34". IWebhookCompatibleEvent was introduced in NC 30, so no version gate is needed.

Refs

Test plan

  • CI passes (composer test:unit)
  • Register a webhook against a homelab NC for OCA\Deck\Event\CardCreatedEvent and confirm the receiver gets {"event": {"card": {…}}, …}
  • Repeat for CardUpdatedEvent, CardDeletedEvent, BoardUpdatedEvent, AclCreatedEvent
  • Confirm token field is absent from the ACL payload

This PR was generated with the help of AI, and reviewed by a Human

Implement OCP\EventDispatcher\IWebhookCompatibleEvent on the event
base classes used by Deck so the webhook_listeners app (NC >= 30) can
deliver them. Card events serialize the full Card payload, ACL events
serialize the Acl entity (with the token already stripped by Acl::
jsonSerialize), and BoardUpdatedEvent exposes the board id it carries.

Refs nextcloud#1722, nextcloud#7299, nextcloud#3341

Signed-off-by: Chris Coutinho <chris@coutinho.io>
@cbcoutinho cbcoutinho force-pushed the feat/webhook-compatible-events branch from 2427d32 to d85e1c8 Compare May 3, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant