check for user email in support request

This commit is contained in:
miloschwartz
2025-10-27 21:56:22 -07:00
parent 8b4722b1c9
commit 772bda69f9

View File

@@ -48,11 +48,20 @@ export async function sendSupportEmail(
const { body, subject } = parsedBody.data;
const user = req.user!;
if (!user?.email) {
return next(
createHttpError(
HttpCode.BAD_REQUEST,
"User does not have an email associated with their account"
)
);
}
try {
await sendEmail(
SupportEmail({
username: user.username,
email: user.email || "Unknown",
email: user.email,
subject,
body
}),