chore: Refactor worker, emails and data cleanup to task system (#3337)
* Refactor worker, all emails on task system * fix * lint * fix: Remove a bunch of expect-error comments in related tests * refactor: Move work from utils.gc into tasks * test * Add tracing to tasks and processors fix: DebounceProcessor triggering on all events Event.add -> Event.schedule
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as React from "react";
|
||||
import { User, Collection } from "@server/models";
|
||||
import { Collection } from "@server/models";
|
||||
import Body from "./components/Body";
|
||||
import Button from "./components/Button";
|
||||
import EmailTemplate from "./components/EmailLayout";
|
||||
@@ -9,26 +9,23 @@ import Header from "./components/Header";
|
||||
import Heading from "./components/Heading";
|
||||
|
||||
export type Props = {
|
||||
actor: User;
|
||||
collection: Collection;
|
||||
eventName: string;
|
||||
unsubscribeUrl: string;
|
||||
};
|
||||
|
||||
export const collectionNotificationEmailText = ({
|
||||
actor,
|
||||
collection,
|
||||
eventName = "created",
|
||||
}: Props) => `
|
||||
${collection.name}
|
||||
|
||||
${actor.name} ${eventName} the collection "${collection.name}"
|
||||
${collection.user.name} ${eventName} the collection "${collection.name}"
|
||||
|
||||
Open Collection: ${process.env.URL}${collection.url}
|
||||
`;
|
||||
|
||||
export const CollectionNotificationEmail = ({
|
||||
actor,
|
||||
collection,
|
||||
eventName = "created",
|
||||
unsubscribeUrl,
|
||||
@@ -40,7 +37,7 @@ export const CollectionNotificationEmail = ({
|
||||
<Body>
|
||||
<Heading>{collection.name}</Heading>
|
||||
<p>
|
||||
{actor.name} {eventName} the collection "{collection.name}".
|
||||
{collection.user.name} {eventName} the collection "{collection.name}".
|
||||
</p>
|
||||
<EmptySpace height={10} />
|
||||
<p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react";
|
||||
import { Document, User, Team, Collection } from "@server/models";
|
||||
import { Document } from "@server/models";
|
||||
import Body from "./components/Body";
|
||||
import Button from "./components/Button";
|
||||
import EmailTemplate from "./components/EmailLayout";
|
||||
@@ -9,34 +9,34 @@ import Header from "./components/Header";
|
||||
import Heading from "./components/Heading";
|
||||
|
||||
export type Props = {
|
||||
actor: User;
|
||||
team: Team;
|
||||
document: Document;
|
||||
collection: Collection;
|
||||
actorName: string;
|
||||
collectionName: string;
|
||||
eventName: string;
|
||||
teamUrl: string;
|
||||
unsubscribeUrl: string;
|
||||
};
|
||||
|
||||
export const documentNotificationEmailText = ({
|
||||
actor,
|
||||
team,
|
||||
actorName,
|
||||
teamUrl,
|
||||
document,
|
||||
collection,
|
||||
collectionName,
|
||||
eventName = "published",
|
||||
}: Props) => `
|
||||
"${document.title}" ${eventName}
|
||||
|
||||
${actor.name} ${eventName} the document "${document.title}", in the ${collection.name} collection.
|
||||
${actorName} ${eventName} the document "${document.title}", in the ${collectionName} collection.
|
||||
|
||||
Open Document: ${team.url}${document.url}
|
||||
Open Document: ${teamUrl}${document.url}
|
||||
`;
|
||||
|
||||
export const DocumentNotificationEmail = ({
|
||||
actor,
|
||||
team,
|
||||
document,
|
||||
collection,
|
||||
actorName,
|
||||
collectionName,
|
||||
eventName = "published",
|
||||
teamUrl,
|
||||
unsubscribeUrl,
|
||||
}: Props) => {
|
||||
return (
|
||||
@@ -48,15 +48,15 @@ export const DocumentNotificationEmail = ({
|
||||
"{document.title}" {eventName}
|
||||
</Heading>
|
||||
<p>
|
||||
{actor.name} {eventName} the document "{document.title}", in the{" "}
|
||||
{collection.name} collection.
|
||||
{actorName} {eventName} the document "{document.title}", in the{" "}
|
||||
{collectionName} collection.
|
||||
</p>
|
||||
<hr />
|
||||
<EmptySpace height={10} />
|
||||
<p>{document.getSummary()}</p>
|
||||
<EmptySpace height={10} />
|
||||
<p>
|
||||
<Button href={`${team.url}${document.url}`}>Open Document</Button>
|
||||
<Button href={`${teamUrl}${document.url}`}>Open Document</Button>
|
||||
</p>
|
||||
</Body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user