Add some features and UI polish for Webhooks.

Review Request #6391 — Created Oct. 1, 2014 and submitted — Latest diff uploaded

Information

Review Board
master
bffb925...

Reviewers

Now that we have support for webhooks in Review Board, it's time to make
them completely awesome and flexible, without being annoyingly hard to
use.

Previously, our webhooks were global across repositories and were forced
into pre-built JSON payloads. This is pretty par-for-the-course for
webhook implementations, but a few implementations out there had some
nice features that were worth bringing in.

Now, webhooks can be tied to one or more repositories, can be set to
apply only for events not matching a repository (such as review requests
that are only used for file uploads), or can be set to always fire
regardless of whether there's a repository.

They can be set to output JSON, XML, or form data payloads (in which
case there will be a payload=<encoded form data> sent to the server.

Payloads are also no longer limited to what we generate. Users can
toggle an option for specifying a custom payload, which gives them a
CodeMirror widget they can edit. This supports the Django template
format, allowing the use of template tags, with the original payload
provided as the variable context. Several scary tags (such as include,
load, etc.) are disabled, and RequestContext is not used, keeping this
safe.

The webhook UI has been updated to provide a bit more guidance, especially
with the new options.

There were a few changes under the hood as well. Instead of a
X-ReviewBoard-Signature, we now use the more standard X-Hub-Signature
(followed by GitHub and others). We also provide a proper User-Agent.

Added unit tests for all the conditions.

Played around with creating some webhooks.

Database evolved successfully.