in src/app/(proper_react)/(redesign)/(authenticated)/admin/prod/actions.tsx [62:86]
export async function triggerManualProfileScan(onerepProfileId: number) {
const session = await getServerSession();
if (!session?.user?.email || !isAdmin(session.user.email)) {
return notFound();
}
console.info("Manual scan initiated by admin for:", onerepProfileId);
try {
const subscriber = await getSubscriberByOnerepProfileId(onerepProfileId);
if (
// On production, only allow looking up Mozilla email addresses
process.env.APP_ENV !== "stage" &&
process.env.APP_ENV !== "local" &&
!isMozMail(subscriber?.primary_email ?? "")
) {
return notFound();
}
const scanResult = await createScan(onerepProfileId);
await refreshStoredScanResults(onerepProfileId);
return scanResult;
} catch (error) {
console.error("Manual scan triggered by admin failed:", error);
}
}