fix email bug
This commit is contained in:
@@ -132,7 +132,6 @@ export async function sendMentionEmail(opts: {
|
||||
message: string;
|
||||
dashboardUrl: string;
|
||||
}) {
|
||||
if (await isDemoMode()) return;
|
||||
const { to, parentName, authorName, message, dashboardUrl } = opts;
|
||||
|
||||
await resend.emails.send({
|
||||
|
||||
@@ -74,15 +74,21 @@ async function notifyMentionedParents(
|
||||
.collection('fams')
|
||||
.getOne(famId)
|
||||
.catch(() => null);
|
||||
// Don't send emails for the demo family.
|
||||
if (fam?.slug === 'showboaters') return;
|
||||
const dashboardUrl = `${siteUrl}/${fam?.slug || famId}`;
|
||||
for (const parent of mentioned) {
|
||||
await sendMentionEmail({
|
||||
to: parent.email,
|
||||
parentName: parent.name || 'there',
|
||||
authorName: message.authorName || 'Family member',
|
||||
message: content,
|
||||
dashboardUrl
|
||||
});
|
||||
try {
|
||||
await sendMentionEmail({
|
||||
to: parent.email,
|
||||
parentName: parent.name || 'there',
|
||||
authorName: message.authorName || 'Family member',
|
||||
message: content,
|
||||
dashboardUrl
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(`[chat] Failed to send mention email to ${parent.email}:`, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user