Specify the URL for users when recording ChangeDescription entries.
Review Request #14410 — Created April 29, 2025 and submitted — Latest diff uploaded
When recording
ChangeDescription
entries for a change in ownership on
a review request, we rely onUser.get_absolute_url()
. This is defined
globally for users viasettings.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 onUser
.To address this properly,
ChangeDescription.record_field_chnage()
now takes an optionalbuild_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.
reviewboard/changedescs/models.py |
---|
reviewboard/changedescs/tests.py |
---|
reviewboard/reviews/builtin_fields.py |
---|