Mail Details: Granular Address Edit Permissions, Upload Center Display Fix, and Client-Scoped Lookups (QA)
Executive summary
This QA batch bundles several mail-details refinements: finer-grained permission control over editing addresses that come from connected systems, a fix so the selected Upload Center now shows correctly in view mode, address and folder lookups that scope by the parent client, and clearer share-dialog wording. It reached the QA/testing environment for verification.
Why this was needed
Users editing mail records needed clearer, safer controls. Backend-sourced (API) addresses were fully locked even for authorized editors, the chosen Upload Center did not always display after saving, and address/folder searches were inconsistently scoped between client and subclient, returning unexpected options. The share dialog also implied mail could be shared with clients when it is user-only.
Client / user impact
- Authorized users (with Edit Mail permission) can now edit most fields of API-sourced addresses, while the address name/label stays locked to protect the source-of-truth label.
- The previously selected Upload Center now displays correctly in both edit and view modes and persists on save.
- Address and folder pickers return options scoped to the relevant parent client, reducing irrelevant results.
- The Share Within System dialog now accurately reads 'Share "N selected mails" with users.'
- An 'Action Required' badge surfaces shared mail needing attention on the mail overview.
Technical scope
Grounded in the diff; bundles feature PRs #574, #577, #579, #580, #582, #584:
- Per-field address edit permissions (
AddressManager.tsx,AddressComponent.tsx): replaced the blanketAPI_SELECTED_ADDRESSES_ARE_IMMUTABLEflag withshouldDisableSelectedAddressInput()keyed off a newcanEditSelectedApiAddressesprop; thenamefield stays read-only viaIMMUTABLE_API_ADDRESS_FIELD_KEY. Wired throughMailOverviewDetails.tsxand resolution-centerResolutionOverviewDetails.tsxusinghasPermission(PERMISSIONS.MAIL.EDIT_MAIL). - Upload Center display/persistence (
ClassificationAndRouting.tsx,mailOverview.store.ts): store now holdsselectedUploadCenteras anOption {value,label}instead of a string id;availableUploadCentersmerges the stored selection with fetched centers so the label renders in view mode; save payload sendscenter: selectedUploadCenter?.value. - Client-scoped lookups (
AddressManager.tsx,ClassificationAndRouting.tsx,folders.services.ts,Folders.queries.ts): address/org searches anduseGetFoldersListnow pass parentclient_idonly (subclient scope removed); blank search text is trimmed/omitted. - UI/wording: share dialog text 'clients and users' -> 'users'; 'Action Required' badge variant
warning->secondary. - Minor refactors:
MailOverviewDetailsconverted to a default export;useCallbackfor resolution edit toggle with corrected effect deps; skeleton className cleanup;.claude/settings.local.jsonallowlist tweak.
Risk & mitigation
Moderate, mixed feature + refactor. Main risks: (1) loosening API-address edits could let edits reach the backend that were previously blocked, so server-side validation/permission enforcement must be confirmed; (2) switching Upload Center from string to Option object touches store init, clone, and save paths and could regress save payloads if any consumer still expects a string; (3) dropping subclient scope from lookups may change which results appear for subclient contexts. Mitigation: the per-field gate falls back to fully read-only when the permission is absent, the name field remains locked, and changes are isolated to mail-details/resolution views and folder services. Verify on QA before promotion.
QA validation focus
- With Edit Mail permission: confirm API-sourced sender/recipient address fields are editable EXCEPT the name field (which stays disabled); without the permission, confirm all API-address fields remain read-only.
- Select an Upload Center, save, reopen in view mode: confirm the selected center's label displays and persists; confirm the saved payload carries the correct center id.
- Verify address/organization and folder pickers return options scoped to the parent client; check behavior for both client and subclient contexts.
- Confirm folder search ignores blank/whitespace queries.
- Verify the Share Within System dialog reads 'with users' and the 'Action Required' badge renders for mail needing attention.
- Regression-check the Resolution Center mail overview edit/save flow (no double refetch) and that the mail overview still renders after the default-export change.