WIP: Refactor the actions system

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

Barret Rennie
Review Board
release-3.0.x
add0aa1...
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: Docs

Ran unit tests.
TODO: Smoke testing, more unit tests.

  • 5
  • 0
  • 0
  • 5
Description From Last Updated
W391 blank line at end of file Review Bot Review Bot
W391 blank line at end of file Review Bot Review Bot
F401 'reviewboard.actions.header.HeaderMenuAction' imported but unused Review Bot Review Bot
F401 'reviewboard.actions.header.HeaderAction' imported but unused Review Bot Review Bot
F841 local variable 'hook' is assigned to but never used Review Bot Review Bot
Checks run (1 failed, 1 succeeded)
JSHint passed.
flake8 failed.

flake8

Loading...