From 6e2e8260011d21bd3c34d938700c40a19d36fa95 Mon Sep 17 00:00:00 2001
From: Dhairyashil Shinde <93669429+dhairyashiil@users.noreply.github.com>
Date: Mon, 15 Dec 2025 14:54:10 +0530
Subject: [PATCH] fix(ooo): make show note publicly consistent across all
booking views (#25827)
- Update weekly view to display OOO when showNotePublicly is true
- Update column view to include days with public notes in schedule
- Add notes and showNotePublicly props to weekly view calendar
- Disable show note publicly checkbox when notes field is empty
---
.../weeklyview/components/event/Empty.tsx | 4 +++-
.../features/calendars/weeklyview/types/state.ts | 2 ++
.../lib/use-schedule/useNonEmptyScheduleDays.ts | 2 +-
.../outOfOffice/CreateOrEditOutOfOfficeModal.tsx | 16 ++++++++++++++--
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/packages/features/calendars/weeklyview/components/event/Empty.tsx b/packages/features/calendars/weeklyview/components/event/Empty.tsx
index e67f99c9b0..66f753c386 100644
--- a/packages/features/calendars/weeklyview/components/event/Empty.tsx
+++ b/packages/features/calendars/weeklyview/components/event/Empty.tsx
@@ -78,7 +78,7 @@ export function AvailableCellsForDay({ timezone, availableSlots, day, startHour
const lastSlot = slotsForToday[lastSlotIndex];
startEndTimeDuration = dayjs(lastSlot.end).diff(dayjs(firstSlot.start), "minutes");
- if (firstSlot.toUser == null) {
+ if (firstSlot.toUser == null && !firstSlot.showNotePublicly) {
return null;
}
@@ -108,6 +108,8 @@ export function AvailableCellsForDay({ timezone, availableSlots, day, startHour
toUser={firstSlot?.toUser}
reason={firstSlot?.reason}
emoji={firstSlot?.emoji}
+ notes={firstSlot?.notes}
+ showNotePublicly={firstSlot?.showNotePublicly}
borderDashed={false}
date={dateFormatted}
className="pb-0"
diff --git a/packages/features/calendars/weeklyview/types/state.ts b/packages/features/calendars/weeklyview/types/state.ts
index edd5f33d19..572f038d71 100644
--- a/packages/features/calendars/weeklyview/types/state.ts
+++ b/packages/features/calendars/weeklyview/types/state.ts
@@ -58,6 +58,8 @@ type TimeRangeExtended = TimeRange & {
toUser?: IToUser;
reason?: string;
emoji?: string;
+ notes?: string | null;
+ showNotePublicly?: boolean;
};
export type CalendarAvailableTimeslots = {
diff --git a/packages/features/schedules/lib/use-schedule/useNonEmptyScheduleDays.ts b/packages/features/schedules/lib/use-schedule/useNonEmptyScheduleDays.ts
index c256946c96..883dab758a 100644
--- a/packages/features/schedules/lib/use-schedule/useNonEmptyScheduleDays.ts
+++ b/packages/features/schedules/lib/use-schedule/useNonEmptyScheduleDays.ts
@@ -8,7 +8,7 @@ export const getNonEmptyScheduleDays = (slots?: Slots) => {
const nonEmptyDays: string[] = [];
Object.keys(slots).forEach((date) => {
- if (slots[date].some((slot) => !(slot?.away && !slot.toUser) && slots[date].length > 0)) {
+ if (slots[date].some((slot) => !(slot?.away && !slot.toUser && !slot.showNotePublicly) && slots[date].length > 0)) {
nonEmptyDays.push(date);
}
});
diff --git a/packages/features/settings/outOfOffice/CreateOrEditOutOfOfficeModal.tsx b/packages/features/settings/outOfOffice/CreateOrEditOutOfOfficeModal.tsx
index 7772f36ebd..2f13c9226c 100644
--- a/packages/features/settings/outOfOffice/CreateOrEditOutOfOfficeModal.tsx
+++ b/packages/features/settings/outOfOffice/CreateOrEditOutOfOfficeModal.tsx
@@ -162,6 +162,8 @@ export const CreateOrEditOutOfOfficeEntryModal = ({
const watchedTeamUserId = watch("toTeamUserId");
const watchForUserId = watch("forUserId");
+ const watchedNotes = watch("notes");
+ const hasValidNotes = Boolean(watchedNotes?.trim());
const createOrEditOutOfOfficeEntry = trpc.viewer.ooo.outOfOfficeCreateOrUpdate.useMutation({
onSuccess: () => {
@@ -345,7 +347,11 @@ export const CreateOrEditOutOfOfficeEntryModal = ({
placeholder={t("additional_notes")}
{...register("notes")}
onChange={(e) => {
- setValue("notes", e?.target.value);
+ const newNotes = e?.target.value;
+ setValue("notes", newNotes);
+ if (!newNotes?.trim()) {
+ setValue("showNotePublicly", false);
+ }
}}
/>
-