Page MenuHomePhabricator

Support Herald in Phriction
Closed, ResolvedPublic


Specific use case for the request was "subscribe to every edit", but one can imagine other similar uses. Some fields which might make sense are:

  • Path
  • Title
  • Body

Revisions and Commits

Event Timeline

epriestley raised the priority of this task from to Normal.
epriestley updated the task description. (Show Details)
epriestley added projects: Herald, Phriction.
epriestley added a subscriber: epriestley.
epriestley added a subscriber: btrahan.

Herald allows users to write rules which react to changes in objects they care about (for example, by notifying the user of the change). We'd like to support Phriction (the wiki) in Herald, so users can easily monitor changes to wiki pages. (One example use case is that I'd personally like to be notified about any edit to any wiki page on this install).

This was blocked technically on T4029, but @btrahan recently completed the work there.

The main driver is a new Adapter class, which lets Herald interact with other systems.

  • You'll write a new PhrictionDocumentHeraldAdapter and put it in src/applications/phriction/herald/.
  • You can find some existing adapters in src/applications/herald/adapter/ (at some point, we'll move these out of Herald and into the respective applications).
  • HeraldPholioMockAdapter is the simplest and most similar existing adapter, and a good place to start from.

The adapter defines how Herald interacts with an application. In particular, you'll want to implement:

  • A "Path" field.
  • A "Body" field.
  • A "Title" field.
  • A "add me to CC" action.
  • A "send me an email" action.

This will let users write rules like "When an edited document's path starts with x/y/z/, send me an email" to watch all documents under "x/y/z/". You may want to start by implementing just one field (probably "Path") and adding the rest later.

To actually create a rule, go to Herald > Create Herald Rule. Once you have a skeleton adapter, your new rule type should show up there and you should be able to start creating a rule.

After creating a rule works, you'll modify PhrictionTransactionEditor to actually make the rules fire when a document is edited. You can look at PholioMockEditor for an example. Likely, you'll implement shouldApplyHeraldRules(), buildHeraldAdapter(), and didApplyHeraldRules().

The Herald UI has some tools (like transcripts and the test console) which can help you debug the behavior of your adapter once it's up and running.