Extending Review Board¶
Review Board is a highly-extensible code review product. Like a browser, anyone can write extensions that improve the product, adding new features, enhancing existing ones, changing the look and feel, and integrating with other services. Here are just a few examples of what you can accomplish by writing an extension:
- Modify the user interface to provide new review request actions, fields, or update the content of e-mails
- Collect statistics and generate reports
- Connect Review Board with other systems (Slack, IRC, Asana, etc.)
- Add new API for collecting or computing custom data
- Implement review UIs for previously unsupported types of files
This guide will cover some of the basics of extension writing, and provide a reference to the Review Board codebase.
To begin, you’ll want to become familiar with a few of the basics of extension writing.
Python Extension Hooks¶
Review Board provides what we call “extension hooks,” which are areas that an extension can hook into in order to modify behavior or UI. There are many extension hooks available to you.
- General Utility Hooks:
- Connects to signals defined by Review Board, Django, or other projects.
- General Page Content Hooks:
- Adds new navigation options to the page alongside “Dashboard,” “All Review Requests,” etc.
- Adds new content to existing templates.
- Defines new URLs in Review Board, which can point to your own custom views.
- Adds a new avatar service, which can be used to provide pictures for user accounts.
- Action Hooks:
A series of hooks used to add new actions for review requests, the diff viewer, and the account/support header at the top of the page.
The following action hooks are available:
- Adds actions to the diff viewer’s review request actions bar.
- Adds actions to the top-right of the page.
- Adds drop-down actions to the top-right of the page.
- Adds actions to the review request actions bar.
- Adds drop-down actions to the review request actions bar.
- API Hooks:
- Adds new capability flags to the root API resource that clients of the API can use to determine whether particular features or capabilities are active.
- Allows for customizing visibility and mutation for keys in
extra_datafields, allowing fields to be private or read-only.
- Datagrid Hooks:
- Adds new columns to the dashboard, for additional information display.
- Add sections and items to the Dashboard sidebar, where the lists of groups are displayed.
- Adds new columns to other datagrids (like the users, groups, and All Review Requests pages).
- Add sections and items to the user page’s sidebar, where information on the user is normally shown.
- Review-related Hooks:
- Adds additional information to the displayed comments on reviews in the review request page and in e-mails.
- Adds thumbnail renderers for file attachments matching certain mimetypes.
- Adds new logic indicating whether a review request can been approved for landing in the codebase.
- Adds new fields to the review request.
- Adds new fieldsets to the review request.
- Adds new review UIs for reviewing file attachments matching certain mimetypes.
- E-mail hooks:
A series of hooks that allow for updating recipients lists for outgoing e-mails.
The following e-mail hooks are available:
- Updates information for e-mails about publishing review requests.
- Updates information for e-mails about closing review requests.
- Updates information for e-mails about new reviews.
- Updates information for e-mails about new replies.
- My Account Page Hooks:
- Administrative Hooks:
Guides to Extending Review Board¶
We have guides on some of the more common types of extensions you might be interested in. Note that some of these are still a work-in-progress.
Code Base Documentation¶
When writing extensions, you will be working directly with the same Review Board classes and methods that we use in the product ourselves.
Please note that not all of these are guaranteed to be API-stable or fully documented.