Use React for rendering Letter of Complaint in production. #1536
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This builds on #1535 to actually render the LOC's HTML via React instead of Django.
It also introduces a few breaking changes:
/loc/letter.(pdf|html)
now only renders the "live preview" version of the letter; it will never render the user's finished letter of complaint (the one stored inLetterRequest.html_content
)./loc/finished-letter.pdf
now only renders the user's finished LOC, and will 404 if the user doesn't have one./loc/admin/:user_id/letter.pdf
now only renders the user's finished LOC. (I was going to rename it tofinished-letter.pdf
for consistent naming but this would require a big airtable re-sync... anyways, we can always change it later.The "email your letter" form now only sends finished LOCs, and will not send in-progress ones (a "You have not completed a Letter of Complaint!" error will be displayed).
Going forward,
LetterRequest.html_content
will now contain the full HTML document of the sent PDF, not just what's inside the<body>
(this brings it in-line with the NoRent letter). However, legacy HTML content will be detected and wrapped in a full HTML document if needed. (At some point we may want to migrate all the legacy versions to the new format, as it will simplify our code and also make those letters more resilient to styling changes.)To do