Specify the URL for users when recording ChangeDescription entries.

Review Request #14410 — Created April 29, 2025 and submitted — Latest diff uploaded

Information

Review Board
release-7.1.x

Reviewers

When recording ChangeDescription entries for a change in ownership on
a review request, we rely on User.get_absolute_url(). This is defined
globally for users via settings.ABSOLUTE_URL_OVERRIDES, but the value
doesn't take into account Local Sites, and on RBCommons we don't have
this set at all, meaning this function is not available on User.

To address this properly, ChangeDescription.record_field_chnage()
now takes an optional build_url_func(), which can be used to let a
caller handle URL computation for the objects. This is specified by
OwnerField to compute a URL relative to the Local Site or global site
for the parent review request.

Removed the ABSOLUTE_URL_OVERRIDES and reproduced the original problem
publishing. Verified that this patch fixed that, and generated a correct
URL for both the global site and Local Site.

Tested this on RBCommons as well.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

orig
1
2
3

Commits

First Last Summary ID Author
Specify the URL for users when recording ChangeDescription entries.
When recording `ChangeDescription` entries for a change in ownership on a review request, we rely on `User.get_absolute_url()`. This is defined globally for users via `settings.ABSOLUTE_URL_OVERRIDES`, but the value doesn't take into account Local Sites, and on RBCommons we don't have this set at all, meaning this function is not available on `User`. To address this properly, `ChangeDescription.record_field_chnage()` now takes an optional `build_url_func()`, which can be used to let a caller handle URL computation for the objects. This is specified by `OwnerField` to compute a URL relative to the Local Site or global site for the parent review request.
e97119d48208db0297315b48f04002e6c93eb2fd Christian Hammond
reviewboard/changedescs/models.py
reviewboard/reviews/builtin_fields.py
Loading...