WIP: Refactor the actions system

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

Barret Rennie
Review Board
release-3.0.x
0ccb1bf...
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.

TODO: more unit tests.

  • Ran unit tests.
  • Built the docs and looked through them.
Loading file attachments...

  • 0
  • 0
  • 5
  • 0
  • 5
Description From Last Updated
Barret Rennie
Review request changed

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: Docs

  ~

TODO: more unit tests.

Testing Done:

~  

Ran unit tests.

~   TODO: Smoke testing, more unit tests.

  ~
  • Ran unit tests.
  ~
  • Built the docs and looked through them.

Commit:

-add0aa18159f99869655273a52f40cbf98cda8c9
+0ccb1bf8908fccba01c1cd83f801be0df14215da

Diff:

Revision 2 (+1256 -1428)

Show changes

Added Files:

Checks run (2 succeeded)

JSHint passed.
flake8 passed.
Loading...