Complete the support for custom license actions.

Review Request #14509 — Created July 15, 2025 and submitted

Information

Review Board
release-7.1.x

Reviewers

Actions are no longer hard-coded client-side, and custom actions no
longer require subclassing RB.LicenseView.

A registered action can now provide extra_data, which can be handled
specially by a RB.LicenseView subclass, and call_args, which will be
included in an action call back to the License Provider when clicked.

License action handlers can provide new license action updates, just
like a Check Update request, by returning license_infos in the
response. It can also redirect to a URL by providing redirect_urls.

This makes it possible for an action to begin a more involved
license-related flow kicked off by the License Provider and going
through other servers or URLs.

Since actions are more dynamic now, we no longer hard-code the Manage
License and Upload License actions within RB.LicenseView. Instead,
BaseLicenseProvider.get_license_actions() now registers these by
default, and subclasses can override them or reposition them.

Since the Upload License action is special, RB.LicenseView still needs
to handle it specially. This is now done through
RB.LicenseView.actionBuilders, which is a mapping of action IDs to
custom builder functions. The Upload License handler is registered in
this mapping.

Unit tests pass.

Registered some custom actions and verified that clicking them triggered
a call handled the License Provider. Also verified that the license_infos
and redirect_url results worked.

Summary ID
Complete the support for custom license actions.
Actions are no longer hard-coded client-side, and custom actions no longer require subclassing `RB.LicenseView`. A registered action can now provide `extra_data`, which can be handled specially by a `RB.LicenseView` subclass, and `call_args`, which will be included in an action call back to the License Provider when clicked. License action handlers can provide new license action updates, just like a Check Update request, by returning `license_infos` in the response. It can also redirect to a URL by providing `redirect_urls`. This makes it possible for an action to begin a more involved license-related flow kicked off by the License Provider and going through other servers or URLs. Since actions are more dynamic now, we no longer hard-code the Manage License and Upload License actions within `RB.LicenseView`. Instead, `BaseLicenseProvider.get_license_actions()` now registers these by default, and subclasses can override them or reposition them. Since the Upload License action is special, `RB.LicenseView` still needs to handle it specially. This is now done through `RB.LicenseView.actionBuilders`, which is a mapping of action IDs to custom builder functions. The Upload License handler is registered in this mapping.
64100d85ff645b637c7139376f1e3b6a6f04f7bd
Description From Last Updated

Shouldn't this be typelets.json?

daviddavid

We should probably have a try/catch here to catch any errors from the async operation.

daviddavid

This doc comment needs "Args:"

daviddavid

Even though it can't be a #method, this can probably still be marked with private.

daviddavid
chipx86
chipx86
maubin
  1. Ship It!
  2. 
      
david
  1. 
      
  2. reviewboard/licensing/actions.py (Diff revision 3)
     
     
    Show all issues

    Shouldn't this be typelets.json?

  3. 
      
chipx86
david
  1. 
      
  2. reviewboard/static/rb/js/admin/views/licenseView.ts (Diff revision 4)
     
     
     
     
     
    Show all issues

    We should probably have a try/catch here to catch any errors from the async operation.

  3. Show all issues

    This doc comment needs "Args:"

  4. Show all issues

    Even though it can't be a #method, this can probably still be marked with private.

    1. Originally I was intending for this to be public so I could specialize it in Power Pack, but not anymore.

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