server/myaccount: exclude deleted OUs from ListMyOrgUnits (#183)#189
Conversation
…ack#183) Filter out soft-deleted org-units (deleted > 0) from the user-facing myaccount list endpoint in both admin and non-admin code paths. The internal ListOrgUnits API continues returning all OUs including deleted ones so that admin tooling and internal services retain full visibility. Also fix default-OU selection to use the first active (non-deleted) OU rather than the first iteration index, which could point to a deleted entry when the filter skips it. Refs: go-core-stack#183 Signed-off-by: Dev Arya <dev-arya23@users.noreply.github.com>
|
Warning Review limit reached
More reviews will be available in 38 minutes and 5 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Filter out soft-deleted org-units (
deleted > 0) from the user-facing/api/myaccount/v1/org-unitsendpoint while keeping the internalListOrgUnitsAPI inclusive.Changes
pkg/server/myaccount.go:ListMyOrgUnitsnow skips entries whereDeleted > 0in both code paths:ouTable.Find(), skip if soft-deletedFindByTenantloop, skip if soft-deletedlen(resp.Items) == 0instead of loop indexi == 0— ensures the first active (non-deleted) OU becomes the default, not the first iteration which may be a deleted entry that gets skippedListOrgUnitsinpkg/server/org-unit.gois not modified — continues returning all OUs including deleted ones for admin tooling and internal service visibilityallow_ou_deleteis disabled (no deleted OUs exist)Refs: #183