Make title optional for non-user created galleries (#3110)

This commit is contained in:
WithoutPants
2022-11-10 14:19:13 +11:00
committed by GitHub
parent c83ebf7c1c
commit 9df66024d1
4 changed files with 15 additions and 3 deletions

View File

@@ -79,8 +79,13 @@ export const GalleryEditPanel: React.FC<
const [createGallery] = useGalleryCreate();
const [updateGallery] = useGalleryUpdate();
const titleRequired =
isNew || (gallery?.files?.length === 0 && !gallery?.folder);
const schema = yup.object({
title: yup.string().required(),
title: titleRequired
? yup.string().required()
: yup.string().optional().nullable(),
details: yup.string().optional().nullable(),
url: yup.string().optional().nullable(),
date: yup.string().optional().nullable(),