Repository navigation
Conversation
2dd2bd3 to
febb1d2
Compare
febb1d2 to
2d3cdeb
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add a settings-layer test covering the legacy-to-canonical computed-settings fallback.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Replaces deprecated avatar/logo URI settings with URL equivalents while preserving legacy compatibility and fixing the Home Assistant webhook documentation.
Changes:
- Adds URL settings and legacy fallbacks.
- Updates avatar/logo consumers and tests.
- Uses the canonical
{{ api_url }}template.
| File | Summary |
|---|---|
zproject/prod_settings_template.py |
Updates the documented avatar setting. |
zproject/default_settings.py |
Defines URL-named settings. |
zproject/computed_settings.py |
Maps legacy settings to canonical names. |
zerver/webhooks/homeassistant/doc.md |
Uses the canonical API URL template. |
zerver/tests/test_upload.py |
Tests URL settings and legacy fallbacks. |
zerver/lib/realm_logo.py |
Uses the URL logo setting with fallback. |
zerver/lib/realm_icon.py |
Uses the URL avatar setting with fallback. |
zerver/lib/avatar.py |
Uses the URL avatar setting with fallback. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Ready for review! Fixed the CI provisioning and test issues, ensured full backward compatibility with test coverage for legacy \DEFAULT_AVATAR_URI\ and \DEFAULT_LOGO_URI, and verified all 26 CI checks pass. |
2d3cdeb to
bbafb08
Compare
bbafb08 to
8932bbf
Compare
|
Could you please update your commit message to match the commit style guidelines? The integration documentation change should probably be done in a separate pull request. And make sure you include a screenshot of the fixed documentation. |
8932bbf to
182b4f8
Compare
|
@laurynmm Thanks for the review! I've made the following changes:
This PR now only contains the |
182b4f8 to
3b14c15
Compare
|
Rebased on main, and dropped the second fallback I had in |
|
Thanks for opening that other PR and updating the commit messages @Aditya-XR! @Vector73 would you have time to do a review on these changes as the last person to look at and work on this area in the codebase? The core team is starting to prep for the 13.0 release and as the issue these changes address isn't on the release priorities board, I don't anticipate anyone having availability to review in the near future. No worries if not. |
Vector73
left a comment
There was a problem hiding this comment.
LGTM. One question: Are we going to migrate other server settings with _URI_ in the names in follow-up PRs?
|
Thanks for the review @Vector73! Yes, I'd like to do the rest as follow-ups. Looking through I'll wait for this one to be merged and then do them one at a time, following the same approach as here. |
laurynmm
left a comment
There was a problem hiding this comment.
@Aditya-XR - I did a quick review of the first commit. Anything I noted there should also be applied to the second commit. Let me know if you have any questions about my review feedback.
| ZULIP_SERVICE_SUBMIT_USAGE_STATISTICS, | ||
| ZULIP_SERVICES_URL, | ||
| ) | ||
| from .configured_settings import DEFAULT_AVATAR_URL as DEFAULT_AVATAR_URL |
There was a problem hiding this comment.
Isn't the list of settings above this being imported from configured_settings?
There was a problem hiding this comment.
Moved DEFAULT_AVATAR_URL and DEFAULT_LOGO_URL into the existing import list above.
To make that work, the tests now read the value from what importlib.reload() returns — mypy won't let them read an imported name straight off computed_settings unless it's explicitly re-exported.
| STATIC_URL = "http://localhost:9991/static/" | ||
|
|
||
| if DEFAULT_AVATAR_URL is None and DEFAULT_AVATAR_URI is not None: | ||
| DEFAULT_AVATAR_URL = DEFAULT_AVATAR_URI |
There was a problem hiding this comment.
This should probably have an explanation here, like we do for the Google Auth replacement.
There was a problem hiding this comment.
Added a comment modeled after the Google auth fallback. I placed it once right above the block so the upcoming renames (CAMO_URI, etc.) can sit underneath it without repeating the explanation for each one.
| # File uploads and avatars | ||
| # TODO: Rename MAX_FILE_UPLOAD_SIZE to have unit in name. | ||
| DEFAULT_AVATAR_URL: str | None = None | ||
| DEFAULT_AVATAR_URI: str | None = None |
There was a problem hiding this comment.
If we still need this setting here, then we need to document that it's deprecated.
| "http://example.com/legacy-avatar.svg", | ||
| ) | ||
|
|
||
| # Canonical DEFAULT_AVATAR_URL takes precedence when both are set |
There was a problem hiding this comment.
This probably won't happen in practice, but we should probably discuss if this should be logged if overridden or if it should be a configuration error that's noted when trying to start up the server.
There was a problem hiding this comment.
Right now, the new name silently wins if both are set, which matches how the existing Google auth and push bouncer fallbacks behave.
Between logging and a config error, a startup check in zerver/checks.py felt like the more reliable option:
- When settings are being loaded, logging isn't initialized yet, and admins can easily miss a log line during an upgrade anyway.
- Both upgrades and
restart-serverrun./manage.py checkbefore restarting the server, so a check will catch the conflict early with a clear message, before the new code starts running.
I went ahead and wired that up in a separate 3rd commit — it only triggers if both settings are configured to different values (and ignores the default values).
Do you think Error is the right severity here, or would a Warning be better? Or would you rather we just keep the silent fallback behavior like the other settings and drop the 3rd commit?
Zulip's naming convention is to use "URL" rather than "URI", so we rename this setting to DEFAULT_AVATAR_URL. Existing installations may still set DEFAULT_AVATAR_URI in their /etc/zulip/settings.py, so we continue to support the old name: if DEFAULT_AVATAR_URL is unset, computed_settings.py falls back to the value of DEFAULT_AVATAR_URI. Fixes part of zulip#23380.
Zulip's naming convention is to use "URL" rather than "URI", so we rename this setting to DEFAULT_LOGO_URL. Existing installations may still set DEFAULT_LOGO_URI in their /etc/zulip/settings.py, so we continue to support the old name: if DEFAULT_LOGO_URL is unset, computed_settings.py falls back to the value of DEFAULT_LOGO_URI. Fixes part of zulip#23380.
DEFAULT_AVATAR_URL and DEFAULT_LOGO_URL only fall back to their old names when they are not set themselves. So if a server sets both names to different values, the old one is silently ignored. Report that as a system check error. The upgrade process and restart-server both run these checks before restarting the server.
3b14c15 to
755bfd2
Compare
|
Thanks for the review, @laurynmm! I've rebased on I also added a third commit to handle the case where both the old and new setting names are configured. I kept it separate so it's easy to drop if we decide we don't want it. |

Zulip uses "URL" rather than the deprecated "URI" (#23380), so this renames the
DEFAULT_AVATAR_URIandDEFAULT_LOGO_URIserver settings toDEFAULT_AVATAR_URLandDEFAULT_LOGO_URL, one commit per setting.Servers upgrading from an older release may still set the old names in
/etc/zulip/settings.py. To keep those working,computed_settings.pycopies the old value into the new setting when only the old one is set, like the Google OAuth settings fallback there. The rest of the code reads only the new names.The third commit adds a system check (
zulip.E008) for a server that sets both names to different values, where the old one would otherwise be silently ignored. It's separate so it can be dropped.Fixes: part of #23380. The Home Assistant docs fix that was first in this PR is now #40197.
How changes were tested:
test_server_settings.py: new tests reloadcomputed_settingsto check that the old name is used when the new one is unset, and that the new one wins when both are set.test_upload.py: the default avatar, realm icon and realm logo tests now set the new names.test_checks.py: the check reports both settings (including the Docker wording), and stays quiet when only one name is set.Screenshots and screen captures:
None, no visual changes.
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: