Fix rendering Review UI extension static media on dev servers.
Review Request #14391 — Created March 24, 2025 and updated — Latest diff uploaded
While developing Power Pack 6 against Review Board 6, a bug was found
where the JavaScript and CSS bundles for the PDF and Office Document review
UIs failed to load on the review UI pages. This only happened on the dev
server when using an installed package of Power Pack 6. This bug didn't
affect production servers. It also didn't affect Review Board 7 dev servers,
which can run with a development install of the Power Pack package.To fix this, we now use Djblets'
ext_js_bundle
andext_css_bundle
template tags instead of Django Pipeline'sjavascript
andstylesheet
tags. The Djblets tags essentially do the same thing as Pipeline's and
call on the Pipeline code in their implementation. The difference is that
the Djblets tags use theExtensionStaticMediaNodeMixin
, which allows them
to render static media for both development setups and installed packages
of extensions on dev servers.This fix relies on a Djblets fix (/r/14390) which will land in 4.0.1.
However, this is backwards compatible with older versions of Djblets in
the sense that nothing will break if Review Board runs with an older version
of Djblets that doesn't include the fix there. The Djblets fix enables
ext_css_bundle
andext_js_bundle
to do the right when passing full
bundle IDs from a review UI'sjs_bundle_names
andcss_bundle_names
attributes. When a server is running with a version of Djblets that
doesn't include the fix, the Djblets tags will return nothing and then
this will fall back on using Pipeline'sjavascript
andstylesheet
tags, which will do the right thing on production servers. One annoying
thing with the backwards compatibility is that when the Djblets tags
return nothing, they'll also output a log warning complaning that the
bundles names don't exist, since the bundle names are the full IDs
instead of relative names which older versions of Djblets can't handle
properly.
- Ran unit tests.
- Ran JS unit tests.
Tested this patch on the following:
- RB6 production and dev servers that contain the Djblets fix.
- RB6 production and dev servers that don't contain the Djblets fix.
- RB7 production and dev servers that contain the Djblets fix.
- RB7 production and dev servers that don't contain the Djblets fix.
reviewboard/templates/reviews/ui/default.html |
---|