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

feat: listings approval emails #3600

Merged
merged 31 commits into from
Sep 1, 2023
Merged

feat: listings approval emails #3600

merged 31 commits into from
Sep 1, 2023

Conversation

ColinBuyck
Copy link
Collaborator

@ColinBuyck ColinBuyck commented Aug 16, 2023

Pull Request Template

Issue Overview

This PR addresses metrotranscom#299, metrotranscom#300,
metrotranscom#302

  • This change addresses the issue in full
  • This change addresses only certain aspects of the issue
  • This change is a dependency for another issue
  • This change has a dependency from another issue

Description

This PR creates a combined endpoint that will update the listing and send a corresponding email to the appropriate users based on the update. The three cases are as follows:

  1. A partner submits a draft listing for admin approval. This will send an email to all admin users to review the listing.
  2. An admin request changes on a listing. This will send an email to all partners/juris admin that have access to that listing.
  3. An admin approves & publishes a listing. This sends an email to all partners/juris admin informing them of a new published listing.

Figma: https://www.figma.com/file/cNRVrLdz8cjXQdSr54BRao/Approval?type=design&node-id=1607-68638&mode=design&t=iL57CewScqDs0pGR-0

Note for Eng: Definitely looking for feedback on my email error handling approach and using the status code of 500 here. I'm feeling unsure if big try/catches is the most elegant solution for this case.

Note for Design (@eajensenwa): I made some guesses on error handling for when the listing is successfully updated but the email fails to send along with when the "broader something went wrong error" occurs but from the details page rather than the edit page.

Currently, the errors are either "Oops! Looks like something went wrong" if the update failed (existing functionality) or "Listing updated but the associated emails failed to send." if just the notify step fails.
Screenshot 2023-08-28 at 11 58 23 PM

How Can This Be Tested/Reviewed?

Pull down locally

  1. Reseed
  2. Sign in to admin@example.com
  3. Change Test: Coliseum to a draft listing
  4. Create an admin account for your work email and a partner account with another email
  5. Sign out
  6. Go to work email and confirm + create new account
  7. Open new incognito window and confirm + create partner account
  8. Go to Test: Coliseum and click submit from partner account
  9. Verify that email of your admin account (work email) has received the correct email with functional links mirroring the request approval designs above
  10. Request changes from admin account
  11. Go to email associated with partner account and verify email accuracy
  12. Click submit again from the partners account
  13. Switch to the admin account and Approve & Publish
  14. Verify the email received by the partner account email

Checklist:

  • My code follows the style guidelines of this project
  • I have added QA notes to the issue with applicable URLs
  • I have performed a self-review of my own code
  • I have reviewed the changes in a desktop view
  • I have reviewed the changes in a mobile view
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have assigned reviewers
  • I have run yarn generate:client and/or created a migration if I made backend changes that require them
  • My commit message(s) is/are polished, and any breaking changes are indicated in the message and are well-described
  • Commits made across packages purposefully have the same commit message/version change, else are separated into different commits

Reviewer Notes:

Steps to review a PR:

  • Read and understand the issue, and ensure the author has added QA notes
  • Review the code itself from a style point of view
  • Pull the changes down locally and test that the acceptance criteria is met
  • Also review the acceptance criteria on the Netlify deploy preview (noting that these do not yet include any backend changes made in the PR)
  • Either explicitly ask a clarifying question, request changes, or approve the PR if there are small remaining changes but the PR is otherwise good to go

On Merge:

If you have one commit and message, squash. If you need each message to be applied, rebase and merge.

@netlify
Copy link

netlify bot commented Aug 16, 2023

Deploy Preview for bloom-demo-public ready!

Name Link
🔨 Latest commit 6f52680
🔍 Latest deploy log https://app.netlify.com/sites/bloom-demo-public/deploys/64f10ea40da04a00088654c8
😎 Deploy Preview https://deploy-preview-3600--bloom-demo-public.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.

@ColinBuyck ColinBuyck changed the title Listings approval emails feat: listings approval emails Aug 16, 2023
@netlify
Copy link

netlify bot commented Aug 16, 2023

Deploy Preview for bloom-exygy-dev ready!

Name Link
🔨 Latest commit 6f52680
🔍 Latest deploy log https://app.netlify.com/sites/bloom-exygy-dev/deploys/64f10ea4524bde00072d2236
😎 Deploy Preview https://deploy-preview-3600--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.

@netlify
Copy link

netlify bot commented Aug 22, 2023

Deploy Preview for bloom-partners-listings-approval ready!

Name Link
🔨 Latest commit 6f52680
🔍 Latest deploy log https://app.netlify.com/sites/bloom-partners-listings-approval/deploys/64f10ea40cea0800082350f2
😎 Deploy Preview https://deploy-preview-3600--bloom-partners-listings-approval.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.

@ColinBuyck ColinBuyck force-pushed the listings-approval-emails branch 6 times, most recently from 28a07c2 to f89c69f Compare August 26, 2023 23:13
@ColinBuyck ColinBuyck marked this pull request as ready for review August 29, 2023 07:19
@ColinBuyck ColinBuyck added the 2 reviews needed Requires 2 more review before ready to merge label Aug 29, 2023
@eajensenwa
Copy link
Collaborator

@ColinBuyck thanks for drafting these messages! A couple of questions: 1) are these consistent with error messaging elsewhere in our system? 2) Is there something actionable the user can do here to troubleshoot?

@emilyjablonski
Copy link
Collaborator

@eajensenwa 1) Other error messages in the system are usually more generic, so something like "Oops something went wrong" - and 2) there isn't something actionable within the portal but it might be helpful to know and they could reach out directly

@emilyjablonski
Copy link
Collaborator

emilyjablonski commented Aug 29, 2023

A note for other reviewers, the emails don't always send to all the right recipients if you're using the +suffix at the end of one emails, using separate accounts worked as expected (ie I expected a +partner and +jurisdictional-admin to both get an email but it would only send it to one of them)

Copy link
Collaborator

@ludtkemorgan ludtkemorgan left a comment

Choose a reason for hiding this comment

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

I'm still reviewing, but wanted to get my initial comments out in case I don't have time to finish it today

backend/core/src/email/email.service.ts Outdated Show resolved Hide resolved
backend/core/src/listings/listings.service.ts Outdated Show resolved Hide resolved
@ColinBuyck
Copy link
Collaborator Author

Thanks for the feedback and catches 🧤 Believe everything should be addressed now except for the ongoing error discussion and future feature flag considerations @emilyjablonski @ludtkemorgan!

@emilyjablonski
Copy link
Collaborator

Request from design for the error message to read "The listing was updated, but due to a technical issue on our end, the associated emails failed to send. If the issue continues, contact support for help."

Copy link
Collaborator

@ludtkemorgan ludtkemorgan left a comment

Choose a reason for hiding this comment

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

I think functionally this looks good. Just one suggestion to add more tests

backend/core/src/listings/listings.service.ts Show resolved Hide resolved
backend/core/src/email/email.service.spec.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@emilyjablonski emilyjablonski left a comment

Choose a reason for hiding this comment

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

LGTM after the error message copy and touching base w Morgan on the last few comments! ⛱️

@emilyjablonski emilyjablonski added 1 review needed Requires 1 more review before ready to merge and removed 2 reviews needed Requires 2 more review before ready to merge labels Aug 31, 2023
Copy link
Collaborator

@ludtkemorgan ludtkemorgan left a comment

Choose a reason for hiding this comment

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

This looks good. Can you create a ticket in the listing approval epic to add those tests so it is not lost?

@ludtkemorgan ludtkemorgan added ready to merge Should be applied when a PR has been reviewed and approved and removed 1 review needed Requires 1 more review before ready to merge labels Aug 31, 2023
@emilyjablonski
Copy link
Collaborator

^ metrotranscom#326

@ColinBuyck
Copy link
Collaborator Author

Thanks @emilyjablonski and @ludtkemorgan! Just got confirmation on error messaging copy and will merge once the tests pass 🥼

@ColinBuyck ColinBuyck merged commit b3e4c8f into main Sep 1, 2023
16 checks passed
emilyjablonski pushed a commit to metrotranscom/doorway that referenced this pull request Sep 1, 2023
* fix: wip email setup

* fix: wip BE service work

* fix: wip email endpoint

* fix: wip module error resolution

* fix: nest error resolution

* fix: functional email endpoint

* fix: email formatting completed

* fix: remove console logs

* fix: undo dto approach

* fix: test coverage

* fix: listing service test cleanup

* fix: final clean up

* fix: are tests going to run?

* fix: corrected permissioning

* fix: start of listings approved

* fix: shift to updateAndNotify

* fix: wip all email flow

* fix: all three email flow

* fix: all email test coverage

* fix: translation error resolution

* fix: logic refactoring + cleanup

* fix: no notification case

* fix: improved type approach

* fix: req user corrections

* fix: listing service commenting

* fix: custom error handling

* fix: remove testing error state

* fix: futher commenting

* fix: pr feedback updates

* fix: remove unused email mock

* fix: error message from design
emilyjablonski pushed a commit to metrotranscom/doorway that referenced this pull request Sep 1, 2023
* fix: wip email setup

* fix: wip BE service work

* fix: wip email endpoint

* fix: wip module error resolution

* fix: nest error resolution

* fix: functional email endpoint

* fix: email formatting completed

* fix: remove console logs

* fix: undo dto approach

* fix: test coverage

* fix: listing service test cleanup

* fix: final clean up

* fix: are tests going to run?

* fix: corrected permissioning

* fix: start of listings approved

* fix: shift to updateAndNotify

* fix: wip all email flow

* fix: all three email flow

* fix: all email test coverage

* fix: translation error resolution

* fix: logic refactoring + cleanup

* fix: no notification case

* fix: improved type approach

* fix: req user corrections

* fix: listing service commenting

* fix: custom error handling

* fix: remove testing error state

* fix: futher commenting

* fix: pr feedback updates

* fix: remove unused email mock

* fix: error message from design
ludtkemorgan pushed a commit to housingbayarea/bloom that referenced this pull request Sep 5, 2023
ludtkemorgan added a commit to housingbayarea/bloom that referenced this pull request Sep 6, 2023
* chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (bloom-housing#3522)

* chore(deps): bump fast-xml-parser from 4.1.3 to 4.2.4 (bloom-housing#3500)

* chore(deps): bump @sideway/formula from 3.0.0 to 3.0.1 (bloom-housing#3354)

* fix: remove updated_at field from listing details page (bloom-housing#3527)

* feat: uptake field value v2 (bloom-housing#3509)

* fix: partners listings table sort by status (bloom-housing#3576)

* fix: add sorting by status

* fix: change default sort to status

* fix: default sorting by status

* fix: sort by application when the same status

* fix: orderBy test using default value

* fix: trigger backend sorting on initial load

* fix: add unsort icon to indicate that column might be sorted

* test: rollback test changes

* fix: use enums to order by status

* chore: upgrade uic

* refactor: use new seeds tag component (bloom-housing#3597)

* feat: submit for approval flow (bloom-housing#3598)

* fix: cors origin deploy preview issues (bloom-housing#3564)

* fix: update label for monthly minimum income (bloom-housing#3609)

* feat: update label for monthly minimum income

* fix: change string to Minimum Monthly Income

* feat: listings approval superadmin flow (bloom-housing#3611)

* fix: add backend url validation for url fields (bloom-housing#3568)

* fix: add backend url validation for url fields

* fix: validate only if externalUrl should be URL

* fix: use form values for application types on failed form submit

* fix: hide url field when no digital application

* fix: set proper default value to common digital application choice

* fix: add hasHttps decorator for second error variant

* fix: add four and five bedrooms keys to sort array (bloom-housing#3618)

* fix: sort table with listings approval statuses (bloom-housing#3622)

* test: add listings approval cypress tests (bloom-housing#3612)

* feat: listings approval emails (bloom-housing#3600)

* fix: use primary tag variants in partners (bloom-housing#3632)

* fix: amiPercentage being unset on unit edit (bloom-housing#3635)

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Krzysztof Zięcina <kziecina@airnauts.com>
Co-authored-by: Emily Jablonski <65367387+emilyjablonski@users.noreply.github.com>
Co-authored-by: ColinBuyck <53269332+ColinBuyck@users.noreply.github.com>
Co-authored-by: Yazeed Loonat <YazeedLoonat@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Should be applied when a PR has been reviewed and approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants