Add a central registry and hooks for custom condition choices.
Review Request #14280 — Created Jan. 1, 2025 and submitted
When we first wrote the support for condition choices for integrations,
we intended for the framework to be extensible, allowing extensions to
produce new condition choices that users could select from. However,
this didn't work in practice, since we lacked any kind of central
registry for condition choices that extensions could hook into.This change introduces a new central
review_request_condition_choices
registry, along with a newReviewRequestConditionChoicesHook
that
wraps it.A central
ReviewRequestConditionsField
can be used whenever a
ConditionsField
is meant to be used withreview_request_condition_choices
,
enabling custom condition choices from any extension. rbintegrations 4.1
will be updated to use this.Documentation has been written to help extension authors make use of the
new hook. It only touches upon the basics of creating new choices, and
doesn't touch upon custom operators, but it should be enough to get
people going.
Unit tests passed.
Tested the new central registry with in-progress code in rbintegrations
and Power Pack.Built the docs. Checked the example code against the unit tests, and
checked for bad links and other errors.
Summary | ID |
---|---|
34336df74418e4338c3a8735fa4cd518dec3a4f4 |
Description | From | Last Updated | ||
---|---|---|---|---|
'reviewboard.extensions.base.Extension' imported but unused Column: 1 Error code: F401 |
![]() |
|||
Should we include type hints in this example? |
|
|||
In order to make some linters happier about the lack of docstrings, can we preface this with _? |
|
|||
Same here. |
|
|||
This needs to be alphabetized. |
|
|||
Doesn't this need a matching _integrations definition? |
|
|||
For this and the other choice_id below, I think it'd be good to prefix it like we recommend to do. … |
![]() |
|||
There are no open issues |
- Change Summary:
-
Removed an unused import.
- Commits:
-
Summary ID edcffe03efc09593aafe2ecd22c157d25fbd40d7 9451fe1c2a3b17921c97ee4cb3d2d58754680aa3 - Diff:
-
Revision 2 (+740 -6)
Checks run (2 succeeded)
- Change Summary:
-
- Added a
_
prefix to internal testing classes. - Fixed import ordering.
- Added a
- Commits:
-
Summary ID 9451fe1c2a3b17921c97ee4cb3d2d58754680aa3 7bb67dbaacbfea7ac34ca4b2de8f9e6ddd3ebf9e - Diff:
-
Revision 3 (+740 -6)
Checks run (2 succeeded)
- Change Summary:
-
Fixed a reference in the docs to the Integrations page.
- Commits:
-
Summary ID 7bb67dbaacbfea7ac34ca4b2de8f9e6ddd3ebf9e 70d9cb2aaae7088b39753ce3bcc3265f84fc4e5a - Diff:
-
Revision 4 (+740 -6)
Checks run (2 succeeded)
- Change Summary:
-
Added vendor prefixes to the example condition choices.
- Commits:
-
Summary ID 70d9cb2aaae7088b39753ce3bcc3265f84fc4e5a 34336df74418e4338c3a8735fa4cd518dec3a4f4 - Diff:
-
Revision 5 (+740 -6)