Hold /privacy behind a flag until counsel reads it, and fix leftover legal and email copy.

This commit is contained in:
adilallo committed 2026-11-20 15:36:06 -07:00
1 parent ead6c8f716
commit 072e5362f5
43 files changed
+548 -191

No files matched your search

+17 -12
View File
@@ -5,8 +5,7 @@ import {
buildWorkshopInboxMail,
type WorkshopInquiryMailInput,
} from "../workshopSignupMail";
import { MAGIC_LINK_TTL_MINUTES } from "../privacyRetention";
import { buildMagicLinkMail } from "./magicLinkMail";
import { buildEmailChangeMail, buildMagicLinkMail } from "./magicLinkMail";
import { getSmtpUrl } from "./env";
import {
buildRuleStakeholderInviteMail,
@@ -26,12 +25,22 @@ function escapeHtml(value: string): string {
.replace(/"/g, """);
}
/** Display name is CommunityRule, one word, even if SMTP_FROM still has a space. */
function formatMailFrom(from: string): string {
const trimmed = from
.trim()
.replace(/^"?Community Rule"?(\s*<)/, "CommunityRule$1");
if (trimmed.includes("<")) return trimmed;
if (trimmed.includes("@")) return `CommunityRule <${trimmed}>`;
return trimmed;
}
export function resolveMailFrom(): string {
return (
const raw =
process.env.SMTP_FROM?.trim() ||
process.env.CLOUDRON_MAIL_FROM?.trim() ||
"noreply@localhost"
);
"noreply@localhost";
return formatMailFrom(raw);
}
/** Avoid quoted-printable `token=3D` wrapping that some webmail clients do not decode. */
@@ -187,16 +196,12 @@ export async function sendWorkshopInquiryConfirmation(input: {
export async function sendEmailChangeEmail(
to: string,
verifyUrl: string,
origin: string,
): Promise<void> {
const { text, html } = buildVerifyLinkParts(
verifyUrl,
`You asked to change the email on your Community Rule account.\n\nOpen this link to confirm the new address (it expires in ${MAGIC_LINK_TTL_MINUTES} minutes):`,
"If you did not request this change, you can ignore this email. Your current login is unchanged until you confirm.",
"Confirm email",
);
const { subject, text, html } = buildEmailChangeMail({ verifyUrl, origin });
await sendHtmlMail({
to,
subject: "Confirm your new Community Rule email",
subject,
text,
html,
devLog: `[dev] Email change verify for ${to}: ${verifyUrl}`,