Build an event dispatch mechanism into Phabricator

Summary:
This is an attempt to satisfy a lot of the one-off requests a little more
generally, by providing a relatively generic piece of event architecture.

Allow the registation of event listeners which can react to various application
events (currently, task editing).

I'll doc this a bit better but I wanted to see if anyone had massive objections
to doing this or the broad approach. The specific problem I want to address is
that one client wants to do a bunch of routing for tasks via email, so it's
either build a hook, or have them override most of ManiphestReplyHandler, or
something slightly more general like this.

Test Plan: Wrote a silly listener that adds "Quack!" to a task every time it is
edited and edited some tasks. I was justly rewarded.

Reviewers: nh, jungejason, tuomaspelkonen, aran

Reviewed By: aran

CC: aran, epriestley

Differential Revision: 881
This commit is contained in:
epriestley
2011-08-31 13:25:13 -07:00
parent 8e8d91a1ff
commit 522e5b4779
23 changed files with 405 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
@title Events User Guide: Installing Event Listeners
@group userguide
Using Phabricator event listeners to customize behavior.
= Overview =
Phabricator allows you to install custom runtime event listeners which can react
to certain things happening (like a Maniphest Task being edited) and run custom
code to perform logging, synchronize with other systems, or modify workflows.
NOTE: This feature is new and experimental, so few events are available and
things might not be completely stable.
= Available Events =
== PhabricatorEventType::TYPE_MANIPHEST_WILLEDITTASK ==
This event is dispatched before a task is edited, and allows you to respond to
or alter the edit. Data available on this event:
- ##task## The {@class:ManiphestTask} being edited.
- ##transactions## The list of edits (objects of class
@{class:ManiphestTransaction}) being applied.
- ##new## A boolean indicating if this task is being created.
- ##mail## If this edit originates from email, the
@{class:PhabricatorMetaMTAReceivedMail} object.