Convert the Review Board extension code to TypeScript.

Review Request #14569 — Created Aug. 21, 2025 and submitted

Information

Review Board
release-7.1.x

Reviewers

Djblets's JavaScript extension code is typed, but our Review Board
aliases were all classic code aliasing to the RB namespace directly.
This prevented any extensions from benefiting from any typing
information for classes, attribute interfaces, or anything else.

We now export those out from appropriate modules in order to retain all
the typing.

However, since the rest of the extension hooks depended on those being
set on RB, and were a bit of a pain to use from TypeScript code, this
change also converts those to TypeScript.

The hooks are very basic, so this is pretty straight-forward. We have
our usual attribute interfaces and our classes. The addition to the
existing code is that there's now dedicated *HookView classes for the
hooks that inject views into other views and pass in particular
attributes. The new views type and assign options so that usage is more
clear and types carry forward.

This is all going into a reviewboard/extensions module, rather than
being rolled up into reviewboard/common, in order to more clearly
separate common interfaces from extension-related code. It is, however,
being merged into the same Pipeline bundle, since pages including the
common bundle expect RB.Extension, the hooks, etc. to exist (which
is also needed for extensions not using ESM).

Unit tests passed.

Tested a few extensions, each making use of these classes. They were
still working as expected.

Ported one (rbcommenttype) to TypeScript and tested again. This tested
CommentDialogHook and ReviewDialogCommentHook. They still work.

Summary ID
Convert the Review Board extension code to TypeScript.
Djblets's JavaScript extension code is typed, but our Review Board aliases were all classic code aliasing to the `RB` namespace directly. This prevented any extensions from benefiting from any typing information for classes, attribute interfaces, or anything else. We now export those out from appropriate modules in order to retain all the typing. However, since the rest of the extension hooks depended on those being set on `RB`, and were a bit of a pain to use from TypeScript code, this change also converts those to TypeScript. The hooks are very basic, so this is pretty straight-forward. We have our usual attribute interfaces and our classes. The addition to the existing code is that there's now dedicated `*HookView` classes for the hooks that inject views into other views and pass in particular attributes. The new views type and assign options so that usage is more clear and types carry forward. This is all going into a `reviewboard/extensions` module, rather than being rolled up into `reviewboard/common`, in order to more clearly separate common interfaces from extension-related code. It is, however, being merged into the same Pipeline bundle, since pages including the `common` bundle expect `RB.Extension`, the hooks, etc. to exist (which is also needed for extensions not using ESM).
1532e1517b02d26b8ee85e42326f828a3c7482dd
Description From Last Updated

Looks like this was copy/pasted from elsewhere? This is about the file attachment thumbnail.

daviddavid

This should be /**

daviddavid

While here, could you update this JS example to be a bit more modern (get rid of the function () …

maubinmaubin

This comment was copy/pasted and needs to be fixed too.

daviddavid

These need to be removed.

daviddavid
david
  1. 
      
  2. Show all issues

    Looks like this was copy/pasted from elsewhere? This is about the file attachment thumbnail.

  3. 
      
jdjdksoshbwj
  1. Ship It!
    1. This is a production server. If you need to do testing, please use https://demo.reviewboard.org/

  2. 
      
jdjdksoshbwj
  1. 
      
  2. 
      
chipx86
maubin
  1. 
      
  2. Show all issues

    While here, could you update this JS example to be a bit more modern (get rid of the function () and var usage).

  3. 
      
david
  1. Ship It!

  2. 
      
david
  1. 
      
  2. Show all issues

    This should be /**

  3. Show all issues

    This comment was copy/pasted and needs to be fixed too.

  4. reviewboard/staticbundles.py (Diff revision 2)
     
     
     
     
     
     
    Show all issues

    These need to be removed.

  5. 
      
chipx86
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-7.1.x (decc5c2)