Skip to content

fix(acms): Updates logic to support PDF uploads from new modal - #423

Merged
albertisfu merged 11 commits into
mainfrom
401-fix-acms-logic-to-upload-pdfs
Feb 17, 2026
Merged

fix(acms): Updates logic to support PDF uploads from new modal#423
albertisfu merged 11 commits into
mainfrom
401-fix-acms-logic-to-upload-pdfs

Conversation

@ERosendo

@ERosendo ERosendo commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds support to intercept PDF downloads from the new ACMS download confirmation modal and upload them to the RECAP Archive.

The new version of ACMS renders a download confirmation modal when a user clicks a document link on the docket page. The modal does not include the docket entry ID or document name in its HTML, so there’s no way to tell which document was clicked using the DOM alone.

On top of that, the modal always displays "Document 1" regardless of which docket entry is actually selected. If the extension relied on parsing this HTML to identify the document, it would incorrectly associate all downloads with docket entry 1, mixing up PDFs from different entries and causing data integrity issues (see freelawproject/recap#401 (comment))

To solve this, this PR introduces a background script function (getDocumentDataFromDownloadModal) that injects a script into the page context to access the DownloadConfirmation instance via window.showDocPageInitializer.modalManager.currentComponent and extracts the docketEntryId and docketEntryDocuments. The data is stored in sessionStorage as a bridge between the page context and the extension's content script.

Changes

  • Add getDocumentDataFromDownloadModal() to extract document data from the page context via script injection
  • Refactor handleAcmsDownloadPage into focused helper methods:
    • isDownloadConfirmationModal: checks if the modal is a billable download page
    • resolveDocumentData: consolidates duplicated logic for looking up the docket entry and document from sessionStorage
    • replaceAcceptChargesButton: swaps the default button with one that intercepts the download for RECAP upload (the original PDF URL is one-time-use)
    • startUploadProcess: fetches the PDF via the merge API and hands the blob to handleDocFormResponse for upload
    • insertRecapBannerIfAvailable: queries the RECAP archive and displays a centered download banner if a cached copy exists

When a user clicks a document link on the ACMS docket page, ACMS opens a download confirmation modal. The modal does not render the docket entry ID or document name in its HTML, making it impossible to determine which docket entry was clicked from the DOM alone.

This commit adds getDocumentDataFromDownloadModal, which injects a script into the page context to access the DownloadConfirmation instance via window.showDocPageInitializer.modalManager.currentComponent and extracts the docketEntryId and docketEntryDocuments. The data is stored in sessionStorage as a bridge between the page context and the extension's content script.
Refactor handleAcmsDownloadPage to support intercepting PDF downloads from the ACMS download confirmation modal and sending them to the RECAP archive.

This refactor breaks the code into focused helper methods:

- `isDownloadConfirmationModal`: checks if the modal is a billable   download page
- `resolveDocumentData`: centralizes logic for looking up the docket entry and specific document from sessionStorage
- `replaceAcceptChargesButton`: swaps the default button with one that intercepts the download so we can fetch the PDF as a blob for RECAP upload
- `startUploadProcess`: fetches the PDF via the merge API and hands the blob to handleDocFormResponse for upload.
- `insertRecapBannerIfAvailable`: queries the RECAP archive and displays a centered download banner if a copy exists
@ERosendo
ERosendo force-pushed the 401-fix-acms-logic-to-upload-pdfs branch from fd64738 to 9f162ec Compare February 8, 2026 20:37
@ERosendo
ERosendo marked this pull request as ready for review February 8, 2026 20:39
@ERosendo
ERosendo requested a review from mlissner February 8, 2026 20:39
@ERosendo ERosendo moved this to To Do in Sprint (Web Team) Feb 8, 2026
@mlissner
mlissner requested review from albertisfu and removed request for mlissner February 9, 2026 00:44
@mlissner mlissner assigned albertisfu and unassigned mlissner Feb 9, 2026
@albertisfu albertisfu moved this from To Do to In progress in Sprint (Web Team) Feb 9, 2026

@albertisfu albertisfu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ERosendo this looks good. I only found a potential issue and some code suggestions.

Comment thread src/appellate/appellate.js Outdated
Comment thread src/appellate/appellate.js Outdated
Comment thread src/appellate/appellate.js Outdated
Comment thread src/appellate/appellate.js Outdated
Comment thread src/appellate/appellate.js Outdated
Comment thread src/appellate/appellate.js Outdated
Comment thread src/appellate/appellate.js Outdated
Comment thread src/appellate/appellate.js Outdated
Comment thread src/utils/background.js Outdated
@albertisfu albertisfu moved this from In progress to To Do in Sprint (Web Team) Feb 11, 2026
@albertisfu albertisfu assigned ERosendo and unassigned albertisfu Feb 11, 2026
@ERosendo ERosendo moved this from To Do to In progress in Sprint (Web Team) Feb 13, 2026
@ERosendo

Copy link
Copy Markdown
Contributor Author

@albertisfu Thanks for your review!

I’ve addressed all your comments, and the PR is ready for another look.

@ERosendo
ERosendo requested a review from albertisfu February 13, 2026 23:53
@ERosendo ERosendo assigned albertisfu and unassigned ERosendo Feb 13, 2026
@ERosendo ERosendo moved this from In progress to To Do in Sprint (Web Team) Feb 13, 2026
Fix incorrect key (documentName) in the JSON stored in sessionStorage when showDocPageInitializer fails to load document data.
Refactor document matching to always use Array.find() instead of branching based on result count.
@ERosendo
ERosendo force-pushed the 401-fix-acms-logic-to-upload-pdfs branch from 4344826 to ebe24d6 Compare February 13, 2026 23:59
@albertisfu albertisfu moved this from To Do to In progress in Sprint (Web Team) Feb 16, 2026

@albertisfu albertisfu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @ERosendo this is now ready to be merged.

@albertisfu
albertisfu merged commit c08e221 into main Feb 17, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Sprint (Web Team) Feb 17, 2026
@albertisfu
albertisfu deleted the 401-fix-acms-logic-to-upload-pdfs branch February 17, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants