Move most email sending to common email function
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { getBanList, setBanList } from "../../../roblox-open-cloud.js";
|
||||
import { GetAccessToken, insertLogs } from "../../../gcloud.js";
|
||||
import { jsonError } from "../../../common.js";
|
||||
import sendEmail from "../../../email.js";
|
||||
|
||||
export async function onRequestPost(context: RequestContext) {
|
||||
const reportId = context.params.id as string;
|
||||
@ -14,6 +15,18 @@ export async function onRequestPost(context: RequestContext) {
|
||||
const actionMap = context.data.body;
|
||||
const newActions: { [k: string]: { BanType: number } } = {};
|
||||
const logMap: { [k: string]: number } = {};
|
||||
const { user } = reportData as ReportCardProps & { user?: { email: string } };
|
||||
|
||||
if (user?.email)
|
||||
await sendEmail(
|
||||
user.email,
|
||||
context.env.MAILGUN_API_KEY,
|
||||
"Report Processed",
|
||||
"report_processed",
|
||||
{
|
||||
username: reportData.user?.username as string,
|
||||
},
|
||||
);
|
||||
|
||||
if (!Object.values(actionMap).find((action) => action !== 0)) {
|
||||
await context.env.DATA.delete(`report_${reportId}`);
|
||||
|
Reference in New Issue
Block a user