Repository navigation
fix: get team's search in own search-list - #16599
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds owner_ids query-parameter support to ChangesOwner ID search filtering
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant Handler
participant SearchService
participant SearchDAO
Client->>Handler: GET /searches?owner_ids=...
Handler->>Handler: getSearchOwnerIDs(c)
alt ownerIDs empty and body present
Handler->>Handler: parse JSON body for owner_ids
end
Handler->>SearchService: ListSearches(ownerIDs, ...)
alt ownerIDs empty
SearchService->>SearchDAO: ListByTenantIDs(nil, userID, ...)
else ownerIDs provided
SearchService->>SearchService: filterAccessibleSearchOwnerIDs(userID, ownerIDs)
SearchService->>SearchDAO: ListByOwnerIDs(filteredOwnerIDs, ...)
end
SearchDAO-->>SearchService: results
SearchService-->>Handler: results
Handler-->>Client: response
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/dao/search.go (1)
59-65: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDrop the unused
tenantIDsbranch
internal/service/search.goonly callsSearchDAO.ListByTenantIDs(nil, ...), so thelen(tenantIDs) > 0path here is currently unreachable. Remove the dead branch or wire in a caller that passes real tenant IDs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/dao/search.go` around lines 59 - 65, The `ListByTenantIDs` query in `search.go` has an unreachable `len(tenantIDs) > 0` branch because `SearchDAO.ListByTenantIDs` is only called with nil from `internal/service/search.go`. Remove the dead `tenantIDs` condition from `ListByTenantIDs`, or update the caller/service flow to pass real tenant IDs if that path is intended, while keeping the existing `query.Where` logic and `userID`/status filtering consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/handler/search.go`:
- Around line 117-134: Restricting owner_ids is missing before the search query,
so a caller can pass arbitrary tenant IDs into search handling. Update the
search handler logic around getSearchOwnerIDs and the ListSearches call to
intersect the requested ownerIDs with the authenticated user’s tenant
memberships before invoking h.searchService.ListSearches, and reject or drop any
IDs the caller does not belong to. Keep the existing GET-body fallback for
compatibility, but ensure the final ownerIDs passed to ListSearches are
caller-validated only.
---
Nitpick comments:
In `@internal/dao/search.go`:
- Around line 59-65: The `ListByTenantIDs` query in `search.go` has an
unreachable `len(tenantIDs) > 0` branch because `SearchDAO.ListByTenantIDs` is
only called with nil from `internal/service/search.go`. Remove the dead
`tenantIDs` condition from `ListByTenantIDs`, or update the caller/service flow
to pass real tenant IDs if that path is intended, while keeping the existing
`query.Where` logic and `userID`/status filtering consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7cd4d038-289f-4fed-9155-ff7c764bc6c7
📒 Files selected for processing (3)
internal/dao/search.gointernal/handler/search.gointernal/service/search.go
### Summary As title:
### Summary As title:
Summary
As title:

bug:
fixed:
