Description
GET /patches only computes approvalStatus when ?orgId= is present, and the web client injects orgId only when a specific org is selected in the org switcher. In "All orgs" mode the Patches tab therefore renders every patch as Pending — including patches that have a partner-wide approval (patch_approvals.ring_id IS NULL).
Since approvals are partner-scoped (not org-scoped), the All-orgs view is exactly where an MSP would expect to see approval state — and it's wrong there.
Repro
Seeded dev stack, partner admin, org switcher on "All orgs" → /patches#patches → a patch with an existing partner-wide approval shows a Review/Pending state. Select a specific org → same patch shows Approved.
Proposed Fix
Compute approvalStatus from the caller's partnerId when no orgId is supplied (approvals don't need an org axis), or have the list endpoint fall back to partner-wide approvals.
Affected Files
apps/api/src/routes/patches/list.ts
Description
GET /patchesonly computesapprovalStatuswhen?orgId=is present, and the web client injectsorgIdonly when a specific org is selected in the org switcher. In "All orgs" mode the Patches tab therefore renders every patch as Pending — including patches that have a partner-wide approval (patch_approvals.ring_id IS NULL).Since approvals are partner-scoped (not org-scoped), the All-orgs view is exactly where an MSP would expect to see approval state — and it's wrong there.
Repro
Seeded dev stack, partner admin, org switcher on "All orgs" → /patches#patches → a patch with an existing partner-wide approval shows a Review/Pending state. Select a specific org → same patch shows Approved.
Proposed Fix
Compute approvalStatus from the caller's partnerId when no orgId is supplied (approvals don't need an org axis), or have the list endpoint fall back to partner-wide approvals.
Affected Files
apps/api/src/routes/patches/list.ts