fix: Collection name missing in notification email

fix: Email styles
This commit is contained in:
Tom Moor committed 2022-06-24 09:50:39 +02:00
1 parent 04f0983e20
commit dd471328db
5 files changed
+50 -38

No files matched your search

+1
View File
@@ -21,6 +21,7 @@ export default async function revisionCreator({
{
name: "revisions.create",
documentId: document.id,
collectionId: document.collectionId,
modelId: revision.id,
teamId: document.teamId,
actorId: user.id,
+1 -1
View File
@@ -18,7 +18,7 @@ export default ({ children, ...rest }: Props) => {
};
return (
<a style={style} {...rest}>
<a style={style} className="content-diff" {...rest}>
{children}
</a>
);
+39 -30
View File
@@ -1,27 +1,31 @@
import theme from "@shared/styles/theme";
export const css = `
font-family: ${theme.fontFamily};
font-weight: ${theme.fontWeight};
font-size: 1em;
line-height: 1.7em;
.content-diff {
font-family: ${theme.fontFamily};
font-weight: ${theme.fontWeight};
font-size: 1em;
line-height: 1.7em;
}
pre {
white-space: pre-wrap;
}
img {
.content-diff img {
text-align: center;
max-width: 100%;
max-height: 75vh;
clear: both;
}
img.image-right-50 {
.content-diff img.image-right-50 {
float: right;
width: 50%;
margin-left: 2em;
margin-bottom: 1em;
clear: initial;
}
img.image-left-50 {
.content-diff img.image-left-50 {
float: left;
width: 50%;
margin-right: 2em;
@@ -153,34 +157,39 @@ export const css = `
-ms-hyphens: none;
hyphens: none;
margin: 0;
code {
font-size: 13px;
background: none;
padding: 0;
border: 0;
}
}
table {
pre code {
font-size: 13px;
background: none;
padding: 0;
border: 0;
}
.content-diff table {
width: 100%;
border-collapse: collapse;
border-radius: 4px;
margin-top: 1em;
box-sizing: border-box;
* {
box-sizing: border-box;
}
tr {
position: relative;
border-bottom: 1px solid ${theme.tableDivider};
}
td,
th {
position: relative;
vertical-align: top;
border: 1px solid ${theme.tableDivider};
position: relative;
padding: 4px 8px;
min-width: 100px;
}
}
.content-diff table * {
box-sizing: border-box;
}
.content-diff table tr {
position: relative;
border-bottom: 1px solid ${theme.tableDivider};
}
.content-diff table td,
.content-diff table th {
position: relative;
vertical-align: top;
border: 1px solid ${theme.tableDivider};
position: relative;
padding: 4px 8px;
min-width: 100px;
}
`;
@@ -1,3 +1,4 @@
import env from "@server/env";
import Document from "@server/models/Document";
import { Event } from "@server/types";
import { globalEventQueue } from "..";
@@ -15,7 +16,8 @@ export default class DebounceProcessor extends BaseProcessor {
globalEventQueue.add(
{ ...event, name: "documents.update.delayed" },
{
delay: 5 * 60 * 1000,
// Revision creation time is lowered to one minute in development
delay: (env.ENVIRONMENT === "production" ? 5 : 1) * 60 * 1000,
}
);
break;
@@ -66,14 +66,14 @@ export default class NotificationsProcessor extends BaseProcessor {
}
async documentPublished(event: DocumentEvent) {
const [document, team] = await Promise.all([
const [collection, document, team] = await Promise.all([
Collection.findByPk(event.collectionId),
Document.findByPk(event.documentId),
Team.findByPk(event.teamId),
]);
if (!document || !team || !document.collection) {
if (!document || !team || !collection) {
return;
}
const { collection } = document;
const notificationSettings = await NotificationSetting.findAll({
where: {
userId: {
@@ -141,15 +141,15 @@ export default class NotificationsProcessor extends BaseProcessor {
}
async revisionCreated(event: RevisionEvent) {
const [document, team, revision] = await Promise.all([
const [collection, document, team, revision] = await Promise.all([
Collection.findByPk(event.collectionId),
Document.findByPk(event.documentId),
Team.findByPk(event.teamId),
Revision.findByPk(event.modelId),
]);
if (!document || !revision || !team || !document.collection) {
if (!document || !revision || !team || !collection) {
return;
}
const { collection } = document;
const notificationSettings = await NotificationSetting.findAll({
where: {
userId: {