Add a base class for groups of actions.

Review Request #14643 — Created Oct. 19, 2025 and updated

Information

Review Board
release-7.1.x

Reviewers

When actions were implemented, the only group of actions we needed were
menus. As we begin to use action for more purposes, we need other groups
of actions, meaning it's a good time to come up with a more general base
class for this.

This change introduces BaseGroupAction, which MenuAction is built
upon. This manages a group of actions, allowing for explicit ordering
and -- just like menus (though it would be up to an implementation how
it wants to handle this).

There's a JavaScript side as well, which is equivalent to what
MenuAction was before. MenuAction is now a very thin subclass over
GroupAction.

For testing, our formerly registry-specific set of test action classes
have been moved into a common module, along with some new actions for
groups.

On top of this, actions now have a parent registry, assigned when
registering and unassigned when unregistering. This is primarily for
unit test purposes, but removes the assumption of actions_registry for
child actions.

Unit tests pass.

Tested all the actions in the UI to make sure they still work and
still show the menu items in the right order.

Summary ID
Add a base class for groups of actions.
When actions were implemented, the only group of actions we needed were menus. As we begin to use action for more purposes, we need other groups of actions, meaning it's a good time to come up with a more general base class for this. This change introduces `BaseGroupAction`, which `MenuAction` is built upon. This manages a group of actions, allowing for explicit ordering and `--` just like menus (though it would be up to an implementation how it wants to handle this). There's a JavaScript side as well, which is equivalent to what `MenuAction` was before. `MenuAction` is now a very thin subclass over `GroupAction`. For testing, our formerly registry-specific set of test action classes have been moved into a common module, along with some new actions for groups. On top of this, actions now have a parent registry, assigned when registering and unassigned when unregistering. This is primarily for unit test purposes, but removes the assumption of `actions_registry` for child actions.
1ad611e3e26f6695432ed73492a262c2068e70f0
Description From Last Updated

'typing.TYPE_CHECKING' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'django.http.HttpRequest' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'django.test.client.RequestFactory' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'reviewboard.actions.registry.ActionsRegistry' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'reviewboard.actions.tests.base.TestAction' imported but unused Column: 1 Error code: F401

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed
Change Summary:

Removed unused imports.

Commits:
Summary ID
Add a base class for groups of actions.
When actions were implemented, the only group of actions we needed were menus. As we begin to use action for more purposes, we need other groups of actions, meaning it's a good time to come up with a more general base class for this. This change introduces `BaseGroupAction`, which `MenuAction` is built upon. This manages a group of actions, allowing for explicit ordering and `--` just like menus (though it would be up to an implementation how it wants to handle this). There's a JavaScript side as well, which is equivalent to what `MenuAction` was before. `MenuAction` is now a very thin subclass over `GroupAction`. For testing, our formerly registry-specific set of test action classes have been moved into a common module, along with some new actions for groups. On top of this, actions now have a parent registry, assigned when registering and unassigned when unregistering. This is primarily for unit test purposes, but removes the assumption of `actions_registry` for child actions.
8993d10740361db62dcb0d8ac4abc5cd8cf30f3b
Add a base class for groups of actions.
When actions were implemented, the only group of actions we needed were menus. As we begin to use action for more purposes, we need other groups of actions, meaning it's a good time to come up with a more general base class for this. This change introduces `BaseGroupAction`, which `MenuAction` is built upon. This manages a group of actions, allowing for explicit ordering and `--` just like menus (though it would be up to an implementation how it wants to handle this). There's a JavaScript side as well, which is equivalent to what `MenuAction` was before. `MenuAction` is now a very thin subclass over `GroupAction`. For testing, our formerly registry-specific set of test action classes have been moved into a common module, along with some new actions for groups. On top of this, actions now have a parent registry, assigned when registering and unassigned when unregistering. This is primarily for unit test purposes, but removes the assumption of `actions_registry` for child actions.
1ad611e3e26f6695432ed73492a262c2068e70f0

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
maubin
  1. Ship It!
  2.