mirror of
https://github.com/outline/outline.git
synced 2025-12-30 07:19:52 -06:00
fix: Incorrect role information in collection added email
This commit is contained in:
@@ -112,6 +112,7 @@ router.get(
|
||||
if (user.isInvited) {
|
||||
await new WelcomeEmail({
|
||||
to: user.email,
|
||||
role: user.role,
|
||||
teamUrl: user.team.url,
|
||||
}).schedule();
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ async function accountProvisioner({
|
||||
if (isNewUser) {
|
||||
await new WelcomeEmail({
|
||||
to: user.email,
|
||||
role: user.role,
|
||||
teamUrl: team.url,
|
||||
}).schedule();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ View Document: ${teamUrl}${collection.path}
|
||||
const permission =
|
||||
membership.permission === CollectionPermission.ReadWrite
|
||||
? "view and edit"
|
||||
: CollectionPermission.Admin
|
||||
: membership.permission === CollectionPermission.Admin
|
||||
? "manage"
|
||||
: "view";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as React from "react";
|
||||
import { UserRole } from "@shared/types";
|
||||
import env from "@server/env";
|
||||
import BaseEmail, { EmailProps } from "./BaseEmail";
|
||||
import Body from "./components/Body";
|
||||
@@ -10,18 +11,28 @@ import Header from "./components/Header";
|
||||
import Heading from "./components/Heading";
|
||||
|
||||
type Props = EmailProps & {
|
||||
role: UserRole;
|
||||
teamUrl: string;
|
||||
};
|
||||
|
||||
type BeforeSend = Record<string, never>;
|
||||
|
||||
/**
|
||||
* Email sent to a user when their account has just been created, or they signed
|
||||
* in for the first time from an invite.
|
||||
*/
|
||||
export default class WelcomeEmail extends BaseEmail<Props> {
|
||||
export default class WelcomeEmail extends BaseEmail<Props, BeforeSend> {
|
||||
protected subject() {
|
||||
return `Welcome to ${env.APP_NAME}`;
|
||||
}
|
||||
|
||||
protected async beforeSend(props: Props) {
|
||||
if (props.role === UserRole.Guest) {
|
||||
return false;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
protected preview() {
|
||||
return `${env.APP_NAME} is a place for your team to build and share knowledge.`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user