Jump to >

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.

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:
SignalHook:
Connects to signals defined by Review Board, Django, or other projects.
General Page Content Hooks:
NavigationBarHook:
Adds new navigation options to the page alongside “Dashboard,” “All Review Requests,” etc.
TemplateHook:
Adds new content to existing templates.
URLHook:
Defines new URLs in Review Board, which can point to your own custom views.
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:

DiffViewerActionHook:
Adds actions to the diff viewer’s review request actions bar.
HeaderActionHook:
Adds actions to the top-right of the page.
HeaderDropdownActionHook:
Adds drop-down actions to the top-right of the page.
ReviewRequestActionHook:
Adds actions to the review request actions bar.
ReviewRequestDropdownActionHook:
Adds drop-down actions to the review request actions bar.
API Hooks:
WebAPICapabilitiesHook:
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.
Datagrid Hooks:
DashboardColumnsHook:
Adds new columns to the dashboard, for additional information display.
DashboardSidebarItemsHook:
Add sections and items to the Dashboard sidebar, where the lists of groups are displayed.
DataGridColumnsHook:
Adds new columns to other datagrids (like the users, groups, and All Review Requests pages).
UserPageSidebarItemsHook:
Add sections and items to the user page’s sidebar, where information on the user is normally shown.
Review-related Hooks:
CommentDetailDisplayHook:
Adds additional information to the displayed comments on reviews in the review request page and in e-mails.
FileAttachmentThumbnailHook:
Adds thumbnail renderers for file attachments matching certain mimetypes.
ReviewRequestApprovalHook:
Adds new logic indicating whether a review request can been approved for landing in the codebase.
ReviewRequestFieldsHook:
Adds new fields to the review request.
ReviewRequestFieldSetsHook:
Adds new fieldsets to the review request.
ReviewUIHook:
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:

ReviewRequestPublishedEmailHook:
Updates information for e-mails about publishing review requests.
ReviewRequestClosedEmailHook:
Updates information for e-mails about closing review requests.
ReviewPublishedEmailHook:
Updates information for e-mails about new reviews.
ReviewReplyPublishedEmailHook:
Updates information for e-mails about new replies.
My Account Page Hooks:
AccountPageFormsHook:
Adds new forms in the My Account page.
AccountPagesHook:
Adds new sub-pages in the My Account page.
Administrative Hooks:
AdminWidgetHook:
Adds new widgets for the administration UI.
AuthBackendHook:
Adds a new authentication backend for logging into Review Board.
HostingServiceHook:
Adds support for new source code or bug tracker hosting services.

JavaScript Extension Hooks

When writing a JavaScript extension, you can make use of some special hooks to augment behavior in Review Board’s UI. These work just like Python hooks.

Review-related Hooks:
CommentDialogHook:
Adds new fields or content to the comment dialog.
ReviewDialogCommentHook:
Adds new fields or content to comments shown in the review dialog.
ReviewDialogHook:
Adds new fields or content to the top of the review dialog.

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.