Add a base class for groups of actions.
Review Request #14643 — Created Oct. 19, 2025 and updated
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, whichMenuActionis 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
MenuActionwas before.MenuActionis 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 ofactions_registryfor
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 |
|---|---|
| 2fba3d9d54d6468579af923f7c99c36db3f0942c |
| Description | From | Last Updated |
|---|---|---|
|
'typing.TYPE_CHECKING' imported but unused Column: 1 Error code: F401 |
|
|
|
'django.http.HttpRequest' imported but unused Column: 1 Error code: F401 |
|
|
|
'django.test.client.RequestFactory' imported but unused Column: 1 Error code: F401 |
|
|
|
'reviewboard.actions.registry.ActionsRegistry' imported but unused Column: 1 Error code: F401 |
|
|
|
'reviewboard.actions.tests.base.TestAction' imported but unused Column: 1 Error code: F401 |
|
|
|
Should probably be "child menu IDs" -> "child action IDs" |
|
|
|
A real exception seems better here too. |
|
|
|
It seems like this must have changed as you iterated. A dict doesn't make sense given the usage here -- … |
|
|
|
It seems like a real exception would be better than assert here. |
|
|
|
Should we instead just do del ... to remove the members? |
|
|
|
Leftover debug output. |
|
|
|
Seems like it might be more consistent/future-proof if we did: export interface MenuActionAttrs extends GroupActionAttrs {} |
|
- Change Summary:
-
Removed unused imports.
- Commits:
-
Summary ID 8993d10740361db62dcb0d8ac4abc5cd8cf30f3b 1ad611e3e26f6695432ed73492a262c2068e70f0 - Diff:
-
Revision 2 (+886 -260)
Checks run (2 succeeded)
-
-
-
-
It seems like this must have changed as you iterated. A dict doesn't make sense given the usage here -- you always set the values to
Trueand never use them later, only using.keys(). Can you change this to use a set?The naming here is also confusing. Can we call it something like
unprocessed_child_ids? -
-
-
-
Seems like it might be more consistent/future-proof if we did:
export interface MenuActionAttrs extends GroupActionAttrs {}
- Change Summary:
-
- Improved docs.
- Added
ActionErrorand raised it in place of a couple assertions. - Switched to
del ...for removing test state. - Removed leftover debug output.
- Switched to an empty interface for
MenuActionAttrs.
- Commits:
-
Summary ID 1ad611e3e26f6695432ed73492a262c2068e70f0 7ddde86011fa90fe21d8fdc7556a13f2dd29cd16 - Diff:
-
Revision 3 (+906 -262)
Checks run (2 succeeded)
- Change Summary:
-
Added
Raisessections for the newActionErrorusage. - Commits:
-
Summary ID 7ddde86011fa90fe21d8fdc7556a13f2dd29cd16 2fba3d9d54d6468579af923f7c99c36db3f0942c - Diff:
-
Revision 4 (+930 -262)