bloom-housing / bloom

Bloom is Exygy’s affordable housing platform. Bloom's goal is to be a single entry point for affordable housing seekers and a hub for application and listing management for developers.
https://bloomhousing.com
Apache License 2.0
33 stars 25 forks source link

fix: improve application submission logic #4179

Closed ColinBuyck closed 4 months ago

ColinBuyck commented 4 months ago

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 4 months ago

Deploy Preview for partners-bloom-dev ready!

Name Link
Latest commit 424cd11617dc03151ba005a61ff626d60121350b
Latest deploy log https://app.netlify.com/sites/partners-bloom-dev/deploys/668cb83357456500086c640d
Deploy Preview https://deploy-preview-4179--partners-bloom-dev.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.

netlify[bot] commented 4 months ago

Deploy Preview for bloom-exygy-dev ready!

Name Link
Latest commit 424cd11617dc03151ba005a61ff626d60121350b
Latest deploy log https://app.netlify.com/sites/bloom-exygy-dev/deploys/668cb83384ff9500080c0d8f
Deploy Preview https://deploy-preview-4179--bloom-exygy-dev.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.