Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(attachment menu): Update logic to identify attachment menu page #269

Merged
merged 4 commits into from
Nov 10, 2022

Conversation

ERosendo
Copy link
Contributor

@ERosendo ERosendo commented Nov 9, 2022

This PR solves multiple issues related to the attachment menu page.

  • Avoid getting hidden inputs in the query to get the download button:
    it seems that some version of CM/ECF uses hidden inputs after the download button and the current logic fails to identify the attachment menu event when the button is there. So in order to avoid those undesired elements in the query, this PR adds the type button in the CSS selector string used by the querySelectorAll method.

  • Identify the attachment page for CM/ECF v1.7:
    CM/ECF v1.7 uses a different style on the attachment menu page. The current logic fails because the button to download the files has a different value. This PR changes the logic that checks the button's value in order to identify the attachment menu in this version.

  • Detecting the attachment menu when the combined file size is over the size limit.
    The buttons to download the files are removed when the combined size of the files is over the size limit of PACER. In such case, the user finds a note at the bottom of the list saying Note: You must view each document individually because the combined PDF would be over the size limit . This issue is described in Attachment pages with lots of big files are not identified as attachment pages#238

    • in CM/ECF v1.7, the note is inside a div tag with an id attribute. This PR adds a query to get this div ( document.getElementById('file_too_big') ) and uses it in the logic validations to identify the attachment page.
    • in older versions of CM/ECF, the note is inside the 'cmecfMainContent' div. This PR adds a query to get this div and checks the text content of the last child.

- Add a type in the queries that match inputs in the page to avoid getting undesired hidden elements while identifying the attachment menu and getting case_id from inputs.
- Add query to get hidden tag with the size limit notice for PACER v1.7.
- Add logic to validate notes at the bottom of the page when the combined file size is over the size limit.

fixes #238, also fixes #291 and should close #304, which are a duplicate.
- Add test to check new logic implemented in the isAttachmentMenuPage function.
- Change id of the main container to match the id used by CM/ECF
- Add spies and fakes to mock DOM methods and avoid errors while
Copy link
Member

@mlissner mlissner left a comment

Choose a reason for hiding this comment

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

One comment, otherwise looks good, thank you!

src/pacer.js Outdated Show resolved Hide resolved
- Add variable to store the result of logical validation of the note that replace the buttons at the bottom of the page when the combined size of the files is over the size limit of CM/ECF.
@mlissner mlissner merged commit 0818418 into main Nov 10, 2022
@mlissner mlissner deleted the 304-attachment-page-not-detected branch November 10, 2022 01:16
@mlissner
Copy link
Member

Great! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants