From c13fce448338d2ca6652fcb3da0efb16e41c03e9 Mon Sep 17 00:00:00 2001 From: Kirankumar Ambati Date: Tue, 13 Jan 2026 23:59:58 +0530 Subject: [PATCH] fix: changes to error on schedule name empty save (#24044) * fix #21709: change to error on schedule name empty save * fix comments * minor enahncemnts --------- Co-authored-by: Volnei Munhoz Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> --- apps/web/modules/availability/[schedule]/schedule-view.tsx | 4 ++++ apps/web/public/static/locales/en/common.json | 1 + .../routers/viewer/availability/schedule/create.schema.ts | 2 +- .../routers/viewer/availability/schedule/update.schema.ts | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/web/modules/availability/[schedule]/schedule-view.tsx b/apps/web/modules/availability/[schedule]/schedule-view.tsx index 93b82d08f5..99d6313ad0 100644 --- a/apps/web/modules/availability/[schedule]/schedule-view.tsx +++ b/apps/web/modules/availability/[schedule]/schedule-view.tsx @@ -120,6 +120,10 @@ export const AvailabilitySettingsWebWrapper = ({ scheduleId && deleteMutation.mutate({ scheduleId }); }} handleSubmit={async ({ dateOverrides, ...values }) => { + if (!values.name.trim()) { + showToast(t("schedule_name_cannot_be_empty"), "error"); + return; + } scheduleId && updateMutation.mutate({ scheduleId, diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index a1c42ece68..ceb5f212cb 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -4010,6 +4010,7 @@ "choose_a_voice_for_your_agent": "Choose a voice for your agent", "trait": "Trait", "voice_id": "Voice ID", + "schedule_name_cannot_be_empty": "Schedule name cannot be empty", "use_voice": "Use voice", "current_voice": "Current voice", "setup_incoming_agent": "Set up incoming agent", diff --git a/packages/trpc/server/routers/viewer/availability/schedule/create.schema.ts b/packages/trpc/server/routers/viewer/availability/schedule/create.schema.ts index 484006b7e0..d2fdf10b7e 100644 --- a/packages/trpc/server/routers/viewer/availability/schedule/create.schema.ts +++ b/packages/trpc/server/routers/viewer/availability/schedule/create.schema.ts @@ -7,7 +7,7 @@ export type TCreateInputSchema = { }; export const ZCreateInputSchema: z.ZodType = z.object({ - name: z.string(), + name: z.string().trim().min(1, "Schedule name cannot be empty"), schedule: z .array( z.array( diff --git a/packages/trpc/server/routers/viewer/availability/schedule/update.schema.ts b/packages/trpc/server/routers/viewer/availability/schedule/update.schema.ts index 7e8b6bfd23..c7fdb20603 100644 --- a/packages/trpc/server/routers/viewer/availability/schedule/update.schema.ts +++ b/packages/trpc/server/routers/viewer/availability/schedule/update.schema.ts @@ -5,7 +5,7 @@ import { timeZoneSchema } from "@calcom/lib/dayjs/timeZone.schema"; export const ZUpdateInputSchema = z.object({ scheduleId: z.number(), timeZone: timeZoneSchema.optional(), - name: z.string().optional(), + name: z.string().trim().min(1, "Schedule name cannot be empty").optional(), isDefault: z.boolean().optional(), schedule: z .array(