Specify the URL for users when recording ChangeDescription entries.
Review Request #14410 — Created April 29, 2025 and submitted
When recording
ChangeDescriptionentries 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
OwnerFieldto compute a URL relative to the Local Site or global site
for the parent review request.
Removed the
ABSOLUTE_URL_OVERRIDESand 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.
| Summary | ID |
|---|---|
| fba37c6f733e3a86e80495ecbe24734c69d0213d |
| Description | From | Last Updated |
|---|---|---|
|
Can we add a unit test that uses build_url_func? |
|
|
|
From the implementation it looks like these should be _T | str | None |
|
|
|
Don't feel like you need to do it, but it might be nice to have @overrides to indicate this? |
|
|
|
Can we add typing for this and the other inner methods? |
|
- Change Summary:
-
- Switched
build_url_func's type for the item to beAny, since_Tprovided the wrong type when storing lists, and added overloads to cover that case. - Added a unit test for
build_url_func.
- Switched
- Commits:
-
Summary ID e97119d48208db0297315b48f04002e6c93eb2fd 31684619ee118721f9a16603ac753b291ee10b3e