mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-05-13 13:17:45 +00:00
feat: send edited miis with bad images to queue as well
related to 975d55bd
This commit is contained in:
parent
975d55bd19
commit
bf670afcf1
2 changed files with 6 additions and 4 deletions
|
|
@ -97,6 +97,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise<
|
|||
const { name, tags, description, quarantined, gender, makeup, miiPortraitImage, miiFeaturesImage, instructions, image1, image2, image3 } = parsed.data;
|
||||
|
||||
// Validate image files
|
||||
let wasImagesModerated = false;
|
||||
const images: File[] = [];
|
||||
|
||||
for (const img of [image1, image2, image3]) {
|
||||
|
|
@ -106,7 +107,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise<
|
|||
if (imageValidation.valid) {
|
||||
images.push(img);
|
||||
} else {
|
||||
return rateLimit.sendResponse({ error: imageValidation.error }, imageValidation.status ?? 400);
|
||||
wasImagesModerated = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -114,11 +115,11 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise<
|
|||
if (mii.platform === "SWITCH") {
|
||||
if (miiPortraitImage) {
|
||||
const validation = await validateImage(miiPortraitImage);
|
||||
if (!validation.valid) return rateLimit.sendResponse({ error: `Failed to verify portrait: ${validation.error}` }, validation.status ?? 400);
|
||||
if (!validation.valid) wasImagesModerated = true;
|
||||
}
|
||||
if (miiFeaturesImage) {
|
||||
const validation = await validateImage(miiFeaturesImage);
|
||||
if (!validation.valid) return rateLimit.sendResponse({ error: `Failed to verify features: ${validation.error}` }, validation.status ?? 400);
|
||||
if (!validation.valid) wasImagesModerated = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -136,6 +137,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise<
|
|||
if (makeup !== undefined) updateData.makeup = makeup;
|
||||
if (instructions !== undefined) updateData.instructions = instructions;
|
||||
if (images.length > 0) updateData.imageCount = images.length;
|
||||
if (wasImagesModerated) updateData.in_queue = true;
|
||||
|
||||
if (Object.keys(updateData).length === 0) return rateLimit.sendResponse({ error: "Nothing was changed" }, 400);
|
||||
const updatedMii = await prisma.mii.update({
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ export default async function MiiPage({ params }: Props) {
|
|||
<div className="bg-zinc-50 border-2 border-zinc-400 rounded-2xl shadow-lg p-4 flex items-center gap-3 text-zinc-700">
|
||||
<Icon icon="material-symbols:timer" className="text-2xl shrink-0" />
|
||||
<p className="font-medium">
|
||||
This Mii is waiting to be manually reviewed {!settings.queueEnabled && "due to inappropriate images "}
|
||||
This Mii is waiting to be manually reviewed {!settings.queueEnabled && "after being auto-flagged for inappropriate images "}
|
||||
and is hidden from the main page.
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue