Update action extension hooks and unit tests.

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

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.
Summary ID
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.
52abd15e9ab01d9a352a7ecff6a8621953183ded
Description From Last Updated

This will only be emitted once per process per text, so if we could put in an identifier like the …

chipx86chipx86

Same as above.

chipx86chipx86

Same as above.

chipx86chipx86

Same as above.

chipx86chipx86

Same as above.

chipx86chipx86

Can the docs be updated here to show these are deprecated and will be removed? We should also just make …

chipx86chipx86

JS naming slipped it. This should be deprecation_message (or really, just message would be fine). Same below.

chipx86chipx86

Blank line between statements/blocks.

chipx86chipx86

Can this be alphabetized?

chipx86chipx86
david
david
chipx86
  1. 
      
  2. reviewboard/extensions/hooks.py (Diff revision 3)
     
     
     
     
     
     

    This will only be emitted once per process per text, so if we could put in an identifier like the ID, that could do a lot to help people porting extensions.

  3. reviewboard/extensions/hooks.py (Diff revision 3)
     
     
     
     
     
     

    Same as above.

  4. reviewboard/extensions/hooks.py (Diff revision 3)
     
     
     
     
     
     

    Same as above.

  5. reviewboard/extensions/hooks.py (Diff revision 3)
     
     
     
     
     

    Same as above.

  6. reviewboard/extensions/hooks.py (Diff revision 3)
     
     
     
     
     
     

    Same as above.

  7. reviewboard/extensions/templatetags/rb_extensions.py (Diff revision 3)
     
     
     
     
     
     
     
     
     
     
     

    Can the docs be updated here to show these are deprecated and will be removed? We should also just make these emit a warning (which will help us find and remove these later).

    1. I think we can actually just remove these now. They're only used in our main templates.

  8. JS naming slipped it. This should be deprecation_message (or really, just message would be fine).

    Same below.

  9. Blank line between statements/blocks.

  10. reviewboard/extensions/tests/test_action_hooks.py (Diff revision 3)
     
     
     
     
     
     
     

    Can this be alphabetized?

  11. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-6.x (4be7938)
Loading...