Add default renderers for group actions.
Review Request #14700 — Created Nov. 18, 2025 and submitted
Attachment points and groups both support specifying default renderers
for any actions nested within. This applied to both standard actions and
group actions, which would do the wrong thing for group actions, and
necessitated that group actions always specify their own renderers.These can now specify the default renderer for any group actions. With
this, an attachment point for a menubar could specify that all group
actions are rendered as menus, and groups in sidebars are rendered as
subsections, as a couple of examples.As an internal optimization, actions now have an
is_action_group
boolean property, which differentiates between an action and an action
group. This avoids the more costlyisinstancechecks that'd otherwise
need to be done multiple times per action render.I also noted cases where fallback renderers weren't being used, and
where an detailed menu item action failed to render correctly with an
action lacking an icon. These have been fixed.
Unit tests pass.
Tested that existing actions work as expected.
Tested along with the upcoming addition of sidebar renderers.
| Summary | ID |
|---|---|
| 6c921413768587ed07e84713f9c062a466fa70d6 |
| Description | From | Last Updated |
|---|---|---|
|
Just noticed that this class docstring is missing "Version Added" |
|
|
|
Given that this is not public API, should we call it _is_action_group? |
|
|
|
Can we add the "Instance variables" comment in here? |
|
|
|
'reviewboard.actions.renderers.ActionSubgroupRendererType' imported but unused Column: 5 Error code: F401 |
|
|
|
line too long (89 > 79 characters) Column: 80 Error code: E501 |
|
|
|
line too long (95 > 79 characters) Column: 80 Error code: E501 |
|
|
|
continuation line under-indented for visual indent Column: 39 Error code: E128 |
|
|
|
'logging' imported but unused Column: 1 Error code: F401 |
|
|
|
Can we add a comment here explaining this case, something like "This attachment point does not allow for child actions." |
|
|
|
This is missing its docstring. |
|
|
|
Seems like these should probably both be logger.error. I don't think we need the traceback in the second case. |
|
- Change Summary:
-
- Added
BaseActionGroupRenderer.render_children()to handle children rendering, recursively. This addresses issues with renderer selection from the previous code, and can recurse. - Added support for
'self'as a value for subgroup renderers, so a group can easily recurse. The template tag is now a thin wrapper around this. - Renamed
is_action_groupto_is_action_group. default_item_renderer_clsanddefault_subgroup_renderer_clsare nowClassVars.- Added a missing
Version Added.
- Added
- Commits:
-
Summary ID 7a279edeaf0730e8c028399fa73ffe61c3f927d3 24cb0636eac8536774cd08e3ec2378e49e02a9b4 - Diff:
-
Revision 2 (+1236 -168)
Checks run (1 failed, 1 succeeded)
flake8
- Change Summary:
-
- Removed unused imports.
- Fixed wrapping issues.
- Commits:
-
Summary ID 24cb0636eac8536774cd08e3ec2378e49e02a9b4 482b22fedfcf47078a5f68d167cb8225eea3e1f5 - Diff:
-
Revision 3 (+1234 -168)
Checks run (2 succeeded)
- Change Summary:
-
- Added a comment explaining what occurs when rendering children using a renderer that isn't a group renderer.
- Added a missing docstring.
- Commits:
-
Summary ID 482b22fedfcf47078a5f68d167cb8225eea3e1f5 6c921413768587ed07e84713f9c062a466fa70d6 - Diff:
-
Revision 4 (+1292 -168)