housingbayarea / bloom

component-based web framework for affordable housing management
Apache License 2.0
5 stars 1 forks source link

fix: improve application submission logic (#4179) #734

Closed ColinBuyck closed 2 months ago

ColinBuyck commented 2 months ago

Pulled over from core

This PR addresses https://github.com/metrotranscom/doorway/issues/698

Description

This PR updates the logic on the FE and BE to block application submissions from past due applications and listings that do not have the common application.

Note that these changes collides with a few existing bugs: 1) You'll notice the addToast line is commented out. I discovered a bug while testing this PR that results in infinite re-renders and subsequently, endless toasts. #4181 image 2) If you change a listing that had a commonApp and answer no to digitalApp, the commonDigitalApp field remains true. The logic checks for both but I wrote up a ticket here: #4182 3) application.e2e-spec.ts has significant amounts of duplicate (copy-pasta) code. Particularly in the creation of dtos. Instead, a base dto should be created and the needed unique fields should override that base dto as opposed from creating it from scratch each time. Captured here (#4183) but for now... I am complicit 😞

How Can This Be Tested/Reviewed?

This can be tested in the following ways. 1) Start on the choose-language page of a listing that is open for common app 2) Go to the partners portal and edit the listing to have a past due date 3) Go back to the public choose-language page and refresh 4) Notice the redirect 5) Fix the listing to be open again and repeat steps 1-4 but this time setting common app to no in the partners portal 6) Fix the listing to be open again and repeat steps 1-4 but this time setting digital app to no in the partners portal

7) Fix the listing and set the due date to be 2 minutes in the future 8) Fill out the application but wait until the due date is past before hitting the summary page 9) You should be redirected 10) Fix the listing to be open again 11) Fill out the application until the summary page 12) Before submitting change the listing to have common app or digital app set to no 13) Try submitting and you should get a something went wrong error (matching the pattern of the past due FE behavior

Note that the commonApp/digitalApp redirect on the summary page is hard to test since the listing is saved in sessionStorage from the choose-language screen on but I am keeping it in place to protect against any malicious or unexpected behavior

Author Checklist:

Review Process:

netlify[bot] commented 2 months ago

Deploy Preview for housing-sanjoseca-gov ready!

Name Link
Latest commit 6ee947d0cde48bd6f8dbed9dba0a1c408bbf0722
Latest deploy log https://app.netlify.com/sites/housing-sanjoseca-gov/deploys/668d6d6deec77e00082cee57
Deploy Preview https://deploy-preview-734--housing-sanjoseca-gov.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.