Skip to content

Commit

Permalink
Look up welcome email text by disease #2712
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Jun 15, 2022
1 parent a9b1311 commit 2cef3bb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 26 deletions.
16 changes: 2 additions & 14 deletions verification/curator-service/api/src/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import bcrypt from 'bcrypt';
import * as crypto from 'crypto';
import EmailClient from '../clients/email-client';
import { ObjectId } from 'mongodb';
import { baseURL } from '../util/base-url';
import { baseURL, welcomeEmail } from '../util/instance-details';

// Global variable for newsletter acceptance
let isNewsletterAccepted: boolean;
Expand Down Expand Up @@ -688,19 +688,7 @@ export class AuthController {
await this.emailClient.send(
[email],
'Welcome to Global.health',
`<p>Hello ${email},</p>
<p>Thank you for registering with Global.health! We're thrilled to have you join our international community and mission to advance the global response to infectious diseases through the sharing of trusted and open public health data.</p>
<p>Here are a few things you can do:</p>
<ul>
<li>Filter and export <a href="https://data.covid-19.global.health">G.h Data</a> containing detailed information on over 50 million anonymized COVID-19 cases from over 100 countries.</li>
<li>Explore the <a href="https://map.covid-19.global.health">G.h Map</a> to see available case data visualized by country, region, and coverage.</li>
<li>Check out our <a href="https://global.health/faqs/">FAQs</a> for more information on our platform, process, team, data sources, citation guidelines, and plans for the future.</li>
<li>Get involved! G.h is being built via a network of hundreds of volunteers that could use your help. If you're interested in joining us, please fill out this <a href="https://global.health/about/#get-involved">form</a>.</li>
<li>Connect with us on <a href="https://twitter.com/globaldothealth">Twitter</a>, <a href="https://www.linkedin.com/company/globaldothealth">LinkedIn</a>, and <a href="https://github.com/globaldothealth">GitHub</a> for the latest news and updates.</li>
</ul>
<p>If you have any questions, suggestions, or connections don't hesitate to email us and a member of our team will be sure to follow up.</p>
<p>Thank you again for your interest and support! We hope G.h proves valuable to your work and look forward to hearing from you.</p>
<p>The G.h Team</p>`,
welcomeEmail(this.disease, email),
);

return done(null, userPublicFields(newUser));
Expand Down
12 changes: 0 additions & 12 deletions verification/curator-service/api/src/util/base-url.ts

This file was deleted.

32 changes: 32 additions & 0 deletions verification/curator-service/api/src/util/instance-details.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const urlMap: { [idx: string]: { [idx: string]: string } } = {
'covid-19': {
local: 'http://localhost:3002',
dev: 'https://dev-data.covid-19.global.health',
qa: 'https://qa-data.covid-19.global.health',
prod: 'https://data.covid-19.global.health',
},
};

export function baseURL(disease: string, environment: string): string {
return urlMap[disease]?.[environment] ?? 'http://localhost:3002';
}

const welcomeMessages: { [idx: string]: string } = {
'covid-19': `<p>Thank you for registering with Global.health! We're thrilled to have you join our international community and mission to advance the global response to infectious diseases through the sharing of trusted and open public health data.</p>
<p>Here are a few things you can do:</p>
<ul>
<li>Filter and export <a href="https://data.covid-19.global.health">G.h Data</a> containing detailed information on over 50 million anonymized COVID-19 cases from over 100 countries.</li>
<li>Explore the <a href="https://map.covid-19.global.health">G.h Map</a> to see available case data visualized by country, region, and coverage.</li>
<li>Check out our <a href="https://global.health/faqs/">FAQs</a> for more information on our platform, process, team, data sources, citation guidelines, and plans for the future.</li>
<li>Get involved! G.h is being built via a network of hundreds of volunteers that could use your help. If you're interested in joining us, please fill out this <a href="https://global.health/about/#get-involved">form</a>.</li>
<li>Connect with us on <a href="https://twitter.com/globaldothealth">Twitter</a>, <a href="https://www.linkedin.com/company/globaldothealth">LinkedIn</a>, and <a href="https://github.com/globaldothealth">GitHub</a> for the latest news and updates.</li>
</ul>
<p>If you have any questions, suggestions, or connections don't hesitate to email us and a member of our team will be sure to follow up.</p>
<p>Thank you again for your interest and support! We hope G.h proves valuable to your work and look forward to hearing from you.</p>
<p>The G.h Team</p>`,
};

export function welcomeEmail(disease: string, email: string): string {
const message = welcomeMessages[disease] ?? '';
return `<p>Hello ${email},</p>\n${message}`;
}

0 comments on commit 2cef3bb

Please sign in to comment.