feat(events): make card, ACL and board events webhook-compatible#7910
Draft
cbcoutinho wants to merge 1 commit intonextcloud:mainfrom
Draft
feat(events): make card, ACL and board events webhook-compatible#7910cbcoutinho wants to merge 1 commit intonextcloud:mainfrom
cbcoutinho wants to merge 1 commit intonextcloud:mainfrom
Conversation
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>
2427d32 to
d85e1c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
OCP\EventDispatcher\IWebhookCompatibleEventon Deck's event base classes so thewebhook_listenersapp (added in NC 30) can serialize and deliver them. Today Deck dispatches plainOCP\EventDispatcher\Eventinstances, 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_webhooksrather than building a webhook system inside Deck). With this change in place, an admin can register listeners forOCA\Deck\Event\CardCreatedEvent,CardUpdatedEvent,CardDeletedEvent,BoardUpdatedEvent, and the ACL events directly through the existing webhook UI.Changes
lib/Event/ACardEvent.phpimplements IWebhookCompatibleEvent—getWebhookSerializable()returns['card' => $card->jsonSerialize()](coversCardCreatedEvent,CardUpdatedEvent,CardDeletedEvent)lib/Event/AAclEvent.phpimplements IWebhookCompatibleEvent—getWebhookSerializable()returns['acl' => $acl->jsonSerialize()]. The existingAcl::jsonSerialize()already stripstoken, so it is not exposed via webhookslib/Event/BoardUpdatedEvent.phpimplements IWebhookCompatibleEvent— returns['boardId' => $boardId](the event only carries the id today; receivers can fetch detail via API if needed)tests/unit/Event/WebhookCompatibleEventsTest.phpCardCreatedEvent,AclCreatedEvent, andBoardUpdatedEventThe shape (
{"<entity>": …}) follows the convention used by core OCP events such asOCP\Files\Events\Node\AbstractNodeEventandOCP\SystemTag\TagAssignedEvent.Compatibility
appinfo/info.xmlrequiresnextcloud min-version="34".IWebhookCompatibleEventwas introduced in NC 30, so no version gate is needed.Refs
Test plan
composer test:unit)OCA\Deck\Event\CardCreatedEventand confirm the receiver gets{"event": {"card": {…}}, …}CardUpdatedEvent,CardDeletedEvent,BoardUpdatedEvent,AclCreatedEventtokenfield is absent from the ACL payloadThis PR was generated with the help of AI, and reviewed by a Human