mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 17:52:16 +00:00
Require description field to be non-empty when reporting issue from the UI (#3939)
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
import { t } from '@/i18n'
|
||||
|
||||
const checkboxField = z.boolean().optional()
|
||||
export const issueReportSchema = z
|
||||
.object({
|
||||
contactInfo: z.string().email().max(320).optional().or(z.literal('')),
|
||||
details: z.string().max(5_000).optional(),
|
||||
details: z
|
||||
.string()
|
||||
.min(1, { message: t('validation.descriptionRequired') })
|
||||
.max(5_000, { message: t('validation.maxLength', { length: 5_000 }) })
|
||||
.optional(),
|
||||
helpType: z.string().optional()
|
||||
})
|
||||
.catchall(checkboxField)
|
||||
@@ -12,7 +18,11 @@ export const issueReportSchema = z
|
||||
path: ['details', 'helpType']
|
||||
})
|
||||
.refine((data) => data.helpType !== undefined && data.helpType !== '', {
|
||||
message: 'Help type is required',
|
||||
message: t('issueReport.validation.helpTypeRequired'),
|
||||
path: ['helpType']
|
||||
})
|
||||
.refine((data) => data.details !== undefined && data.details !== '', {
|
||||
message: t('issueReport.validation.descriptionRequired'),
|
||||
path: ['details']
|
||||
})
|
||||
export type IssueReportFormData = z.infer<typeof issueReportSchema>
|
||||
|
||||
Reference in New Issue
Block a user