isomerpages / isomercms-backend

A static website builder and host for the Singapore Government
5 stars 1 forks source link

fix(site launch email): make table nicer #732

Closed kishore03109 closed 1 year ago

kishore03109 commented 1 year ago

Problem

Currently, the emails that are being sent to operations is very bare. This had led to copy pasting errors before, leading to issues with the site launch process in the end / our users have complained that the this information is unclear. As a low handing fruit, this PR changes the way the DNS results are being rendered for lesser chances of error.

Closes IS-94

Solution

This PR has two main changes.

  1. Adds inline HTML styles to make the tables look nicer, refer to the screenshots below for a visual change.
  2. Refactoring of the code. Right now, our formSgSiteLaunch.ts has too much responsibility, I have created a SendDNSRecordEmailClient.ts whose responsibility would be to return the body of the email content.

Reviewer Notes

Feedback wanted: While I am certain I want to shift the logic needed to generate the body of the html to a separate file, not too sure where might be a best place to put the file SendDNSRecordEmailClient.ts in, open to feedback regarding this!

Breaking Changes

Before & After Screenshots

BEFORE:

Screenshot 2023-04-26 at 1 06 14 PM Screenshot 2023-04-26 at 1 07 21 PM

AFTER:

Screenshot 2023-04-26 at 12 53 22 PM Screenshot 2023-04-26 at 12 52 11 PM

Tests

_Step 0: Set your export MOCK_AMPLIFY_DOMAIN_ASSOCIATION_CALLS="true"_ Step 1. Run this from server.js to trigger a fake formsg response

const formResponses = [
  {
    submissionId: "",
    requesterEmail: "kishore@open.gov.sg",
    repoName: "kishore-test",
    primaryDomain: "kishorewithwww.isomer.gov.sg",
    redirectionDomain: "www.kishorewithwww.isomer.gov.sg",
    agencyEmail: "alexander@open.gov.sg",
  },
  {
    submissionId: "",
    requesterEmail: "kishore@open.gov.sg",
    repoName: "test-vincent",
    primaryDomain: "kishorewithoutwww.isomer.gov.sg",
    redirectionDomain: "",
    agencyEmail: "alexander@open.gov.sg",
  },
]

formsgSiteLaunchRouter.handleSiteLaunchResults(formResponses, "test")

Step 2: Refer to terminal output for resulting email content

QiluXie commented 1 year ago

When we merge this PR, we can observe the corresponding Jira ticket and see if the automaton rule works.