diff --git a/server/commands/revisionCreator.ts b/server/commands/revisionCreator.ts index 408f4013ff..9ce4db287c 100644 --- a/server/commands/revisionCreator.ts +++ b/server/commands/revisionCreator.ts @@ -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, diff --git a/server/emails/templates/components/Diff.tsx b/server/emails/templates/components/Diff.tsx index be2d205893..fc31c897d4 100644 --- a/server/emails/templates/components/Diff.tsx +++ b/server/emails/templates/components/Diff.tsx @@ -18,7 +18,7 @@ export default ({ children, ...rest }: Props) => { }; return ( - + {children} ); diff --git a/server/emails/templates/components/css.ts b/server/emails/templates/components/css.ts index 2324c9e13c..3fc7727de5 100644 --- a/server/emails/templates/components/css.ts +++ b/server/emails/templates/components/css.ts @@ -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; } `; diff --git a/server/queues/processors/DebounceProcessor.ts b/server/queues/processors/DebounceProcessor.ts index 1984532b52..8759e6e8ff 100644 --- a/server/queues/processors/DebounceProcessor.ts +++ b/server/queues/processors/DebounceProcessor.ts @@ -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; diff --git a/server/queues/processors/NotificationsProcessor.ts b/server/queues/processors/NotificationsProcessor.ts index 6a640e6ef5..a4d1cb71c6 100644 --- a/server/queues/processors/NotificationsProcessor.ts +++ b/server/queues/processors/NotificationsProcessor.ts @@ -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: {