Mail & Document Fixes: PDF Zoom, Bulk Delete, Assignment Flow, and Caching (QA)
Executive summary
A QA batch bundling five frontend fixes across the Mail and Document experiences: consistent PDF preview zoom, a new "delete all documents" action in mail details, a smoother move-to-processing assignment flow, suppression of browser autofill on share-mail address fields, and reduced redundant network calls by caching entity types. These are targeted bug fixes and refinements, not new modules.
Why this was needed
QA and production usage surfaced several rough edges: PDFs previewed inside the iframe opened at an inconsistent zoom; users had no quick way to clear all documents on a mail; the client blocked moving mail to "Processing" with its own assignment check that could diverge from backend rules; password managers overlapped the To/Cc/Bcc fields in the share-mail dialog; and entity-type lookups re-fired on every page that opened a resolution modal.
Client / user impact
- PDF previews now open at page width with horizontal fit, so documents render at a predictable size every time.
- Users with delete permission get a one-click "Delete all documents" button (with a confirmation prompt) in a mail's Documents view.
- Moving mail to Processing no longer trips client-side blocks; the backend is the single source of truth for assignment rules, giving consistent error messages.
- The share-via-mail recipient fields no longer collide with password-manager popups.
- Resolution assignment screens load faster and make fewer duplicate calls because entity types are cached once.
Technical scope
Bundles feature PRs #698, #699, #700 plus follow-ups:
- PDF zoom (#698)
PDFViewerCore.tsx: appendszoom=page-widthandview=FitHhash directives (guarding against duplicates) and resolves relative file URLs againstwindow.location.href. - Bulk delete
MailDocuments.tsx: adds permission-gated "Delete all documents" button +ConfirmationPrompt, optimistic state pruning, and cache invalidation; deletes via newmail_idspayload. - Assignment flow (#700)
MailContents.tsx,columns.tsx: removes client-side "assign before Processing" guards from row, drawer, and single-transition paths; defers validation to the API. - Autofill (#699)
ShareViaMailDialog.tsx: per-field ids/names anddata-lpignorefor To/Cc/Bcc. - Entity-type caching new
constants/queryKeys.ts(ENTITY_TYPES_QUERY_KEY);useGetEntityTypesconsolidated intoentityType.queries.tswithenabledtoggle; duplicategetEntityTypesservice/route removed; lists memoized in two resolution modals. - Service
document.services.ts:deleteDocumentnow accepts mutually-exclusivedocument_ids/mail_ids, makesupdated_byoptional, and validates that an identifier is present. - Minor: responsive layout for mail-details tabs and document header;
AGENTS.mddoc-rule wording.
Risk & mitigation
Moderate, well-scoped. The main behavior change is removing client-side assignment validation for move-to-processing, so the backend must reliably reject unassigned transitions and return clear messages; otherwise users could be allowed to start a transition that then fails. "Delete all documents" is destructive but gated by permission and a confirmation prompt. The PDF URL handling adds parsing branches (relative URLs, malformed hashes) that fall back to the raw URL on error. Mitigation: this is a QA-stage batch intended for testing before production promotion.
QA validation focus
- Preview multiple PDFs (cloud-stored and relative paths, with/without existing hash params) and confirm they open at page width without double zoom directives.
- As a user with delete permission, use "Delete all documents" on a mail; confirm the prompt, removal, and that grids/counts refresh; verify the button is hidden without permission or when there are no documents.
- Move mail to Processing from row menu, drawer, and single-transition button while unassigned and assigned; confirm backend errors surface correctly and the assign-user retry flow still works.
- Open the share-via-mail dialog and confirm To/Cc/Bcc fields do not trigger password-manager overlays.
- Open resolution Add/Assign modals across several pages and confirm entity types load from cache (no repeated network calls) and selectors populate.