feat(ui): enhance workspace switcher and company logo settings#497
feat(ui): enhance workspace switcher and company logo settings#497
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b04648b8ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <button | ||
| type="button" | ||
| className="tenant-switcher-action" | ||
| onClick={() => { | ||
| setShowTenantMenu(false); | ||
| navigate('/enterprise'); | ||
| }} |
There was a problem hiding this comment.
Gate company-settings action to admin roles
The new workspace popover always renders the Company settings action, so member/agent_admin users can now navigate to /enterprise even though tenant management APIs (e.g. get_tenant in backend/app/api/tenants.py) explicitly require org_admin or platform_admin. This introduces a broken path for non-admin users and exposes an admin-only entry point that was previously role-gated in the sidebar; wrap this button in the same role check as before.
Useful? React with 👍 / 👎.
| data = await file.read() | ||
| if len(data) > 1024 * 1024: | ||
| raise HTTPException(status_code=400, detail="Logo image must be 1 MB or smaller") | ||
| try: | ||
| image = Image.open(io.BytesIO(data)) |
There was a problem hiding this comment.
Reject oversized logo dimensions before decoding
The upload handler enforces only encoded file size (<=1 MB) but then fully decodes and converts the image without any pixel-dimension cap. Highly compressed large PNG/WebP files can stay under 1 MB while expanding to very large in-memory buffers during image.load()/convert("RGBA"), which can stall or OOM API workers. Add a maximum width/height (or total pixel) check before expensive processing.
Useful? React with 👍 / 👎.
Summary
Verification
npm run buildpython -m py_compile backend/app/api/tenants.py backend/app/models/tenant.py backend/app/api/auth.py backend/app/schemas/schemas.pygit diff --checkMerge Notes
This branch was cut from an older
release. Latestorigin/releaseadds tenantdefault_model_id; this branch adds tenantlogo_url. If GitHub reports conflicts, resolve by keeping both fields:TenantOut: keep bothdefault_model_idandlogo_url.Tenant: keep both thedefault_model_idmapped column and thelogo_urlproperty.I validated that latest
origin/releaseplus this resolution builds successfully in a temporary worktree.