Send the invitation as a light letter that names the community, the inviter by email, and who can read the Rule.
This commit is contained in:
1 parent
70ceb73104
commit
727a92a9ac
14 files changed
+534
-26
No files matched your search
+11
-13
@@ -6,6 +6,10 @@ import {
|
||||
type WorkshopInquiryMailInput,
|
||||
} from "../workshopSignupMail";
|
||||
import { getSmtpUrl } from "./env";
|
||||
import {
|
||||
buildRuleStakeholderInviteMail,
|
||||
type RuleStakeholderInviteMailInput,
|
||||
} from "./ruleStakeholderInviteMail";
|
||||
|
||||
function escapeHtml(value: string): string {
|
||||
return value
|
||||
@@ -93,24 +97,18 @@ export async function sendMagicLinkEmail(
|
||||
});
|
||||
}
|
||||
|
||||
/** Stakeholder invite after rule publish (one-time link, same dev/Mailhog pattern as magic link). */
|
||||
/** Stakeholder invite after finishing a Rule (one-time link, same Mailhog pattern as magic link). */
|
||||
export async function sendRuleStakeholderInviteEmail(
|
||||
to: string,
|
||||
verifyUrl: string,
|
||||
ruleTitle: string,
|
||||
input: RuleStakeholderInviteMailInput,
|
||||
): Promise<void> {
|
||||
const { text, html } = buildVerifyLinkParts(
|
||||
verifyUrl,
|
||||
`You've been invited to view "${ruleTitle}" on Community Rule.\n\nOpen this link to create your account (or sign in) and open the rule. The link expires in 60 minutes and works once:`,
|
||||
"If you did not expect this, you can ignore this email.",
|
||||
"Open the rule",
|
||||
);
|
||||
const { subject, text, html } = buildRuleStakeholderInviteMail(input);
|
||||
await sendHtmlMail({
|
||||
to,
|
||||
subject: `You're invited to view a Community Rule: ${ruleTitle}`,
|
||||
to: input.to,
|
||||
subject,
|
||||
text,
|
||||
html,
|
||||
devLog: `[dev] Rule stakeholder invite (${ruleTitle}) for ${to}: ${verifyUrl}`,
|
||||
replyTo: input.inviterEmail.trim().toLowerCase(),
|
||||
devLog: `[dev] Rule stakeholder invite (${input.communityName}) for ${input.to}: ${input.verifyUrl}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user