Addressed comments

This commit is contained in:
Jori Lallo 2017-11-12 16:35:23 -08:00
parent a8ace3ca60
commit c74ed3ad65
4 changed files with 19 additions and 15 deletions

View File

@ -42,7 +42,7 @@ Object {
<tr>
<td align=\\"center\\">
<span style=\\"display: none !important; color: #FFFFFF; margin:0; padding:0; font-size:1px; line-height:1px;\\">Outline is a place for your team to build and share knowledge.</span>
<table width=\\"550\\" padding=\\"40\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td align=\\"left\\"><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td width=\\"100%\\" height=\\"40px\\" style=\\"line-height:40px;font-size:1px;mso-line-height-rule:exactly\\">&nbsp;</td></tr></tbody></table><p><strong>Welcome to Outline!</strong></p><p>Outline is a place for your team to build and share knowledge.</p><p>To get started, head to your dashboard and try creating a collection to help document your workflow, create playbooks or help with team onboarding.</p><p>You can also import existing Markdown document by drag and dropping them to your collections</p><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td width=\\"100%\\" height=\\"10px\\" style=\\"line-height:10px;font-size:1px;mso-line-height-rule:exactly\\">&nbsp;</td></tr></tbody></table><p><a href=\\"http://localhost:3000/dashboard\\" style=\\"display:inline-block;padding:10px 20px;color:#FFFFFF;background:#000000;border-radius:4px;font-weight:500;text-decoration:none;cursor:pointer\\">View my dashboard</a></p><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td width=\\"100%\\" height=\\"40px\\" style=\\"line-height:40px;font-size:1px;mso-line-height-rule:exactly\\">&nbsp;</td></tr></tbody></table></td></tr></tbody></table><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td width=\\"75%\\" style=\\"padding:20px 0;border-top:1px solid #e8e8e8;color:#9BA6B2;font-size:14px\\"><a href=\\"http://localhost:3000\\" style=\\"color:#9BA6B2;text-decoration:none\\">Outline</a></td></tr></tbody></table></td></tr></tbody></table>
<table width=\\"550\\" padding=\\"40\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td align=\\"left\\"><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td width=\\"100%\\" height=\\"40px\\" style=\\"line-height:40px;font-size:1px;mso-line-height-rule:exactly\\">&nbsp;</td></tr></tbody></table><p><strong>Welcome to Outline!</strong></p><p>Outline is a place for your team to build and share knowledge.</p><p>To get started, head to your dashboard and try creating a collection to help document your workflow, create playbooks or help with team onboarding.</p><p>You can also import existing Markdown document by drag and dropping them to your collections</p><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td width=\\"100%\\" height=\\"10px\\" style=\\"line-height:10px;font-size:1px;mso-line-height-rule:exactly\\">&nbsp;</td></tr></tbody></table><p><a href=\\"http://localhost:3000/dashboard\\" style=\\"display:inline-block;padding:10px 20px;color:#FFFFFF;background:#000000;border-radius:4px;font-weight:500;text-decoration:none;cursor:pointer\\">View my dashboard</a></p><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td width=\\"100%\\" height=\\"40px\\" style=\\"line-height:40px;font-size:1px;mso-line-height-rule:exactly\\">&nbsp;</td></tr></tbody></table></td></tr></tbody></table><table width=\\"100%\\" border=\\"0\\" cellSpacing=\\"0\\" cellPadding=\\"0\\"><tbody><tr><td style=\\"padding:20px 0;border-top:1px solid #E8EBED;color:#9BA6B2;font-size:14px\\"><a href=\\"http://localhost:3000\\" style=\\"color:#9BA6B2;text-decoration:none\\">Outline</a></td></tr></tbody></table></td></tr></tbody></table>
</td>
</tr>
</table>

View File

@ -1,17 +1,18 @@
// @flow
import React from 'react';
import { Table, TBody, TR, TD } from 'oy-vey';
import { color } from '../../../shared/styles/constants';
export default () => {
const style = {
padding: '20px 0',
borderTop: '1px solid #e8e8e8',
color: '#9BA6B2',
borderTop: `1px solid ${color.smokeDark}`,
color: color.slate,
fontSize: '14px',
};
const linkStyle = {
color: '#9BA6B2',
color: color.slate,
textDecoration: 'none',
};
@ -19,7 +20,7 @@ export default () => {
<Table width="100%">
<TBody>
<TR>
<TD width="75%" style={style}>
<TD style={style}>
<a href={process.env.URL} style={linkStyle}>
Outline
</a>

View File

@ -15,11 +15,14 @@ router.get('/:type/:format', async ctx => {
};
switch (ctx.params.type) {
case 'welcome':
previewMailer.welcome('user@example.com');
break;
// case 'emailWithProperties':
// previewMailer.emailWithProperties('user@example.com', {...properties});
// break;
default:
throw httpErrors.NotFound();
if (Object.getOwnPropertyNames(previewMailer).includes(ctx.params.type)) {
// $FlowIssue flow doesn't like this but we're ok with it
previewMailer[ctx.params.type]('user@example.com');
} else throw httpErrors.NotFound();
}
if (!mailerOutput) return;

View File

@ -2,7 +2,6 @@
import React from 'react';
import nodemailer from 'nodemailer';
import Oy from 'oy-vey';
import invariant from 'invariant';
import { baseStyles } from './emails/components/EmailLayout';
import { WelcomeEmail, welcomeEmailText } from './emails/WelcomeEmail';
@ -22,8 +21,8 @@ type SendMailType = {
*
* Mailer class to contruct and send emails.
*
* To preview emails, add a new preview to `emails/index.js` and visit following
* URLs in development mode:
* To preview emails, add a new preview to `emails/index.js` if they
* require additional data (properties). Otherwise preview will work automatically.
*
* HTML: http://localhost:3000/email/:email_type/html
* TEXT: http://localhost:3000/email/:email_type/text
@ -35,16 +34,17 @@ class Mailer {
*
*/
sendMail = async (data: SendMailType): ?Promise<*> => {
if (this.transporter) {
const { transporter } = this;
if (transporter) {
const html = Oy.renderTemplate(data.html, {
title: data.title,
headCSS: [baseStyles, data.headCSS].join(' '),
previewText: data.previewText,
});
invariant(this.transporter, 'very sure this.transporter exists');
try {
await this.transporter.sendMail({
await transporter.sendMail({
from: process.env.SMTP_SENDER_EMAIL,
to: data.to,
subject: data.title,