Update action extension hooks and unit tests.

Review Request #12775 — Created Jan. 9, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-6.x

Reviewers

This is the final change for the new actions framework, covering the
extension hooks and unit tests.

I've repurposed the old ActionHook (which was just used as a generic
base class) to be the new entry point for actions. This simply takes a
list of BaseAction instances and handles registering and unregistering
as appropriate.

The old legacy action hooks have been updated to translate the
dictionary definitions into BaseAction instances, which are then passed
upward to the ActionHook base class. These are all now treated as
deprecated, and will warn appropriately.

This also fixes up a variety of issues discovered with the unit tests.

  • Built an extension that used all of the hooks, both the modern and
    legacy. Saw that everything worked appropriately.
  • Ran python unit tests.
  • Ran js-tests.
  • Built codebase and manual documentation and checked all related
    pages for content and spelling.

Diff Revision 3

This is not the most recent revision of the diff. The latest diff is revision 4. See what's changed.

orig
1
2
3
4

Commits

First Last Summary ID Author
Update action extension hooks and unit tests.
This is the final change for the new actions framework, covering the extension hooks and unit tests. I've repurposed the old `ActionHook` (which was just used as a generic base class) to be the new entry point for actions. This simply takes a list of `BaseAction` instances and handles registering and unregistering as appropriate. The old legacy action hooks have been updated to translate the dictionary definitions into BaseAction instances, which are then passed upward to the ActionHook base class. These are all now treated as deprecated, and will warn appropriately. This also fixes up a variety of issues discovered with the unit tests. The majority of these fixes are in the extension tests, but this also involved updating the review request actions to use `apply_to` to limit their rendering so that we wouldn't attempt to render their JavaScript side on pages that were not review-request related. Testing Done: - Built an extension that used all of the hooks, both the modern and legacy. Saw that everything worked appropriately. - Ran python unit tests. - Ran js-tests. - Built codebase and manual documentation and checked all related pages for content and spelling.
6e93fe0f9d0568fa0344e607b8267c0024e825a2 David Trowbridge
reviewboard/extensions/hooks.py
reviewboard/extensions/templatetags/rb_extensions.py
reviewboard/extensions/tests/test_action_hooks.py
reviewboard/extensions/tests/test_sandbox_hooks.py
reviewboard/reviews/actions.py
reviewboard/static/rb/css/pages/base.less
reviewboard/templates/extensions/action.html
reviewboard/templates/extensions/header_action_dropdown.html
reviewboard/templates/extensions/header_action_with_image.html
Loading...