Add workspace rules PDF document upload, view, and management UI#89414
Add workspace rules PDF document upload, view, and management UI#89414ishpaul777 wants to merge 5 commits intoExpensify:mainfrom
Conversation
… rules PDF document upload, view, and management UI""
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
@carlosmiceli Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@MelvinBot below this 2 issues were caused by this Changes and were reverted in #89362, can you summarize and suggest fixes |
Summary & Suggested FixesBoth issues were caused by #87684 (workspace rules PDF document upload) and reverted in #89362. Issue #89345 — Password-protected PDFs accepted + modal loopProblem: Fix: Before calling Issue #89341 — Blank PDF preview on Android (native)Problem: The Fix: Add <PDFThumbnail
previewSourceURL={rulesDocumentSourceURL}
style={[styles.flex1, styles.w100]}
/>Both fixes are small and can be included in this PR before re-landing. |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b66c649d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const mappedTypes = acceptedFileTypes.reduce<string[]>((result, extension) => { | ||
| const nativeType = EXTENSION_TO_NATIVE_TYPE[String(extension)]; | ||
| if (nativeType !== undefined && !result.includes(nativeType)) { | ||
| result.push(nativeType); | ||
| } | ||
| return result; | ||
| }, []); | ||
| pickerTypes = mappedTypes.length > 0 ? mappedTypes : [types.allFiles]; |
There was a problem hiding this comment.
Keep allowed extensions selectable on native picker
When acceptedFileTypes includes a mix of mapped and unmapped extensions, this reducer silently drops the unmapped ones and still applies a restricted pickerTypes list. In this repo, receipt uploads pass CONST.API_ATTACHMENT_VALIDATIONS.ALLOWED_RECEIPT_EXTENSIONS (which includes values like html, xml, rtf, and message), so those backend-allowed file types become unselectable on native because they are not represented in EXTENSION_TO_NATIVE_TYPE. This is a regression from the prior behavior where native used types.allFiles and relied on validation afterward.
Useful? React with 👍 / 👎.
…workspace-rules-document-upload
…ve WorkspaceOverviewPage with pending rules document management and error handling for protected PDFs.
…ated private notes function.
Explanation of Change
Adds frontend support for workspace admins to upload, replace, view, and delete a PDF rules document on the workspace overview page. Non-admins can view/download the document. This is the frontend (App) portion of a multi-repo change.
Key changes:
rulesDocumentURLfield on the Policy Onyx typeupdatePolicyRulesDocument/deletePolicyRulesDocumentaction functions with optimistic/failure/finally Onyx updatesWORKSPACE_DOCUMENTroute andWorkspaceDocumentModalContentgetRulesDocumentSourceURLutility routing remote URLs through authenticatedGetPolicyRulesDocumentstreaming endpoint with cache-bustingKey decisions:
rulesDocumentURL(notpolicyDocumentURL) —policyprefix is redundant inside a policy objectfile.uri(local blob URL) for instant display — same pattern as workspace avatar&cacheBuster=encoding the fullrulesDocumentURL— ensures unique streaming URL per PDF versionWORKSPACE_DOCUMENTroute instead of reusingREPORT_ATTACHMENTSCompanion PRs:
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/610806
PROPOSAL: N/A (internal feature implementation)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2026-05-02.at.10.02.39.PM.mov
Android: mWeb Chrome
Screen.Recording.2026-05-03.at.1.00.04.AM.mov
iOS: Native
Screen.Recording.2026-04-16.at.1.10.39.AM.mov
iOS: mWeb Safari
Screen.Recording.2026-04-16.at.1.10.02.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-05-02.at.9.49.24.PM.mov
Screen.Recording.2026-05-02.at.9.49.24.PM.mov