mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-25 14:26:39 +00:00
check for user email in support request
This commit is contained in:
@@ -48,11 +48,20 @@ export async function sendSupportEmail(
|
|||||||
const { body, subject } = parsedBody.data;
|
const { body, subject } = parsedBody.data;
|
||||||
const user = req.user!;
|
const user = req.user!;
|
||||||
|
|
||||||
|
if (!user?.email) {
|
||||||
|
return next(
|
||||||
|
createHttpError(
|
||||||
|
HttpCode.BAD_REQUEST,
|
||||||
|
"User does not have an email associated with their account"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await sendEmail(
|
await sendEmail(
|
||||||
SupportEmail({
|
SupportEmail({
|
||||||
username: user.username,
|
username: user.username,
|
||||||
email: user.email || "Unknown",
|
email: user.email,
|
||||||
subject,
|
subject,
|
||||||
body
|
body
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user