Refactor the actions system

Review Request #9131 - Created Aug. 11, 2017 and updated

Barret Rennie
Review Board
release-3.0.x
a10e69f...
reviewboard

This is a large patch that refactors the action registry system
implemented by a past student to use a proper registry. Much refactoring
has been done:

  • Action base classes now live in reviewboard.actions. This package
    also includes header dropdown actions.
  • Review request-specific action classes now live in
    reviewboard.reviews.actions.
  • ALL action hooks support new-style action classes and old-style
    dicts. Previously, there was a discrepancy betweeen which hooks
    supported which type of action.
  • ActionHook is now deprecated in favour of ReviewRequestActionHook.
    The behaviour was the previously the same, except ActionHook supported
    old-style dicts instead of classes. Now that the behaviour of all
    hooks has been unified, we no longer need this distinction.
  • The {% child_actions %} templatetag has been moved from reviewtags
    to a new actions template tag library. It now takes the action it
    should list the child actions of.
  • The _DictAction and _DictMenuAction classes have been turned into
    the DictActionMixin.
  • There are now two action registries: one for review request actions
    and one for header actions. This allows us to keep them seperate.
  • We now store instances of dict actions instead of the dicts
    themselves. This is because you cannot store a dict in a set (as
    it is unhashable) and therefore cannot be put into a Registry.
  • Generic action templates now live in templates/actions.
  • Ran unit tests.
  • Built the docs and looked through them.
Loading file attachments...

  • 0
  • 0
  • 7
  • 0
  • 7
Description From Last Updated
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

Barret Rennie
Barret Rennie
Review request changed

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

Barret Rennie
Barret Rennie
Barret Rennie
Review request changed

Summary:

-WIP: Refactor the actions system
+Refactor the actions system

Description:

   

This is a large patch that refactors the action registry system

    implemented by a past student to use a proper registry. Much refactoring
    has been done:

   
   
  • Action base classes now live in reviewboard.actions. This package
    also includes header dropdown actions.
   
  • Review request-specific action classes now live in
    reviewboard.reviews.actions.
   
  • ALL action hooks support new-style action classes and old-style
    dicts. Previously, there was a discrepancy betweeen which hooks
    supported which type of action.
   
  • ActionHook is now deprecated in favour of ReviewRequestActionHook.
    The behaviour was the previously the same, except ActionHook supported
    old-style dicts instead of classes. Now that the behaviour of all
    hooks has been unified, we no longer need this distinction.
   
  • The {% child_actions %} templatetag has been moved from reviewtags
    to a new actions template tag library. It now takes the action it
    should list the child actions of.
   
  • The _DictAction and _DictMenuAction classes have been turned into
    the DictActionMixin.
   
  • There are now two action registries: one for review request actions
    and one for header actions. This allows us to keep them seperate.
   
  • We now store instances of dict actions instead of the dicts
    themselves. This is because you cannot store a dict in a set (as
    it is unhashable) and therefore cannot be put into a Registry.
   
  • Generic action templates now live in templates/actions.
-  
-  

TODO: more unit tests.

Loading...