Fixes: Collection creation notification email

Added: Unsubscribe option to notification email footers
Added: Two new notification types (emails not written yet)
Fixed: Validation added to notification setting events
This commit is contained in:
Tom Moor
2018-12-05 23:44:41 -08:00
parent cc8dacba32
commit 9ca0038d39
8 changed files with 131 additions and 17 deletions

View File

@@ -13,6 +13,7 @@ export type Props = {
actor: User,
collection: Collection,
eventName: string,
unsubscribeUrl: string,
};
export const collectionNotificationEmailText = ({
@@ -20,7 +21,7 @@ export const collectionNotificationEmailText = ({
collection,
eventName = 'created',
}: Props) => `
"${document.title}" ${eventName}
${collection.name}
${actor.name} ${eventName} the collection "${collection.name}"
@@ -31,17 +32,16 @@ export const CollectionNotificationEmail = ({
actor,
collection,
eventName = 'created',
unsubscribeUrl,
}: Props) => {
return (
<EmailTemplate>
<Header />
<Body>
<Heading>
"{collection.name}" {eventName}
</Heading>
<Heading>{collection.name}</Heading>
<p>
{actor.name} {eventName} the collection "{collection.title}".
{actor.name} {eventName} the collection "{collection.name}".
</p>
<EmptySpace height={10} />
<p>
@@ -51,7 +51,7 @@ export const CollectionNotificationEmail = ({
</p>
</Body>
<Footer />
<Footer unsubscribeUrl={unsubscribeUrl} />
</EmailTemplate>
);
};

View File

@@ -14,6 +14,7 @@ export type Props = {
document: Document,
collection: Collection,
eventName: string,
unsubscribeUrl: string,
};
export const documentNotificationEmailText = ({
@@ -36,6 +37,7 @@ export const DocumentNotificationEmail = ({
document,
collection,
eventName = 'published',
unsubscribeUrl,
}: Props) => {
return (
<EmailTemplate>
@@ -60,7 +62,7 @@ export const DocumentNotificationEmail = ({
</p>
</Body>
<Footer />
<Footer unsubscribeUrl={unsubscribeUrl} />
</EmailTemplate>
);
};

View File

@@ -4,14 +4,24 @@ import { Table, TBody, TR, TD } from 'oy-vey';
import { twitterUrl, spectrumUrl } from '../../../shared/utils/routeHelpers';
import theme from '../../../shared/styles/theme';
export default () => {
const style = {
type Props = {
unsubscribeUrl?: string,
};
export default ({ unsubscribeUrl }: Props) => {
const footerStyle = {
padding: '20px 0',
borderTop: `1px solid ${theme.smokeDark}`,
color: theme.slate,
fontSize: '14px',
};
const unsubStyle = {
padding: '0',
color: theme.slate,
fontSize: '14px',
};
const linkStyle = {
color: theme.slate,
fontWeight: 500,
@@ -29,7 +39,7 @@ export default () => {
<Table width="100%">
<TBody>
<TR>
<TD style={style}>
<TD style={footerStyle}>
<a href={process.env.URL} style={linkStyle}>
Outline
</a>
@@ -41,6 +51,15 @@ export default () => {
</a>
</TD>
</TR>
{unsubscribeUrl && (
<TR>
<TD style={unsubStyle}>
<a href={unsubscribeUrl} style={linkStyle}>
Unsubscribe from these emails
</a>
</TD>
</TR>
)}
</TBody>
</Table>
);