Skip to content

feat: show originally scheduled time in rescheduled meeting emails#28865

Open
SinghaAnirban005 wants to merge 1 commit intocalcom:mainfrom
SinghaAnirban005:feat/email
Open

feat: show originally scheduled time in rescheduled meeting emails#28865
SinghaAnirban005 wants to merge 1 commit intocalcom:mainfrom
SinghaAnirban005:feat/email

Conversation

@SinghaAnirban005
Copy link
Copy Markdown
Contributor

@SinghaAnirban005 SinghaAnirban005 commented Apr 13, 2026

What does this PR do?

This PR ensures that when a booking is rescheduled email notifications show the original booking time (with line through) above the new time so recipients can immediately see when free time opened up and how far the meeting was moved.

Video Demo (if applicable):

Screencast.from.2026-04-13.13-32-55.webm

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

@SinghaAnirban005 SinghaAnirban005 requested a review from a team as a code owner April 13, 2026 09:42
@github-actions github-actions bot added emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email Low priority Created by Linear-GitHub Sync ✨ feature New feature or request 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Apr 13, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

📝 Walkthrough

Walkthrough

This change extends the system to track and display previous event times when a booking is rescheduled. The CalendarEvent interface in the types package gains two optional string properties for previousStartTime and previousEndTime. The booking email handler is updated to extract these values from the original rescheduled booking data and pass them to email and SMS sending functions. The email component is modified to conditionally render the previous time range with formatting helpers that respect timezone and locale settings, displaying it with strikethrough styling in the email template.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding the originally scheduled time display in rescheduled meeting emails.
Linked Issues check ✅ Passed The code changes fully implement the requirements from issue #22406: displaying original meeting time in rescheduled emails with line-through styling, allowing recipients to assess schedule impact.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue requirements: adding previousStartTime/previousEndTime fields and rendering them in email notifications.
Description check ✅ Passed The PR description clearly explains the feature purpose, references related issues, includes a video demo, and covers mandatory tasks.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/features/bookings/lib/BookingEmailSmsHandler.ts (1)

117-143: ⚠️ Potential issue | 🟠 Major

Add error handling in rescheduled notification flow.

_handleRescheduled is the only notification path here without a try/catch; a mail/SMS failure can escape and disrupt the side-effect pipeline.

Suggested fix
   private async _handleRescheduled(data: RescheduleEmailAndSmsPayload) {
@@
     const { sendRescheduledEmailsAndSMS } = await import("@calcom/emails/email-manager");
-    await sendRescheduledEmailsAndSMS(
-      {
-        ...evt,
-        previousStartTime: originalRescheduledBooking?.startTime
-        ? dayjs(originalRescheduledBooking.startTime).utc().format()
-        : undefined,
-        previousEndTime: originalRescheduledBooking?.endTime
-        ? dayjs(originalRescheduledBooking.endTime).utc().format()
-        : undefined,
-        additionalInformation,
-        additionalNotes,
-        cancellationReason: `$RCH$${rescheduleReason || ""}`,
-      },
-      metadata
-    );
+    try {
+      await sendRescheduledEmailsAndSMS(
+        {
+          ...evt,
+          previousStartTime: originalRescheduledBooking?.startTime
+            ? dayjs(originalRescheduledBooking.startTime).utc().format()
+            : undefined,
+          previousEndTime: originalRescheduledBooking?.endTime
+            ? dayjs(originalRescheduledBooking.endTime).utc().format()
+            : undefined,
+          additionalInformation,
+          additionalNotes,
+          cancellationReason: `$RCH$${rescheduleReason || ""}`,
+        },
+        metadata
+      );
+    } catch (err) {
+      this.log.error("Failed to send rescheduled event related emails and SMS", err);
+    }
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/features/bookings/lib/BookingEmailSmsHandler.ts` around lines 117 -
143, _handleRescheduled currently calls sendRescheduledEmailsAndSMS without
protection so any mail/SMS error can escape; wrap the await
sendRescheduledEmailsAndSMS(...) call in a try/catch inside _handleRescheduled,
catch any thrown error, log it (use this.logger.error if available, otherwise
processLogger/console.error) including contextual data (evt, metadata,
rescheduleReason), and swallow or handle the error so it does not propagate and
break the side-effect pipeline.
🧹 Nitpick comments (1)
packages/features/bookings/lib/BookingEmailSmsHandler.ts (1)

131-136: Deduplicate previous-time UTC conversion logic.

The same conversion block appears in both reschedule handlers; extracting one helper will prevent drift and keep behavior consistent.

Refactor sketch
 export class BookingEmailSmsHandler {
   private readonly log: Pick<Logger<unknown>, "warn" | "debug" | "error">;
+  private toUtcIso(value?: string | Date | null) {
+    return value ? dayjs(value).utc().format() : undefined;
+  }
@@
-        previousStartTime: originalRescheduledBooking?.startTime
-        ? dayjs(originalRescheduledBooking.startTime).utc().format()
-        : undefined,
-        previousEndTime: originalRescheduledBooking?.endTime
-        ? dayjs(originalRescheduledBooking.endTime).utc().format()
-        : undefined,
+        previousStartTime: this.toUtcIso(originalRescheduledBooking?.startTime),
+        previousEndTime: this.toUtcIso(originalRescheduledBooking?.endTime),
@@
-      previousStartTime: originalRescheduledBooking?.startTime
-          ? dayjs(originalRescheduledBooking.startTime).utc().format()
-          : undefined,
-        previousEndTime: originalRescheduledBooking?.endTime
-          ? dayjs(originalRescheduledBooking.endTime).utc().format()
-          : undefined,
+      previousStartTime: this.toUtcIso(originalRescheduledBooking?.startTime),
+      previousEndTime: this.toUtcIso(originalRescheduledBooking?.endTime),

Also applies to: 167-172

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/features/bookings/lib/BookingEmailSmsHandler.ts` around lines 131 -
136, Extract the repeated UTC conversion of originalRescheduledBooking start/end
times into a single helper (e.g., a private method on BookingEmailSmsHandler
such as formatBookingTimesToUtc(originalBooking) that returns {
previousStartTime, previousEndTime } where each value is computed with
dayjs(...).utc().format() or undefined) and replace the duplicated blocks in
both reschedule handlers (the places referencing originalRescheduledBooking) to
call that helper so behavior is centralized and consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/features/bookings/lib/BookingEmailSmsHandler.ts`:
- Around line 117-143: _handleRescheduled currently calls
sendRescheduledEmailsAndSMS without protection so any mail/SMS error can escape;
wrap the await sendRescheduledEmailsAndSMS(...) call in a try/catch inside
_handleRescheduled, catch any thrown error, log it (use this.logger.error if
available, otherwise processLogger/console.error) including contextual data
(evt, metadata, rescheduleReason), and swallow or handle the error so it does
not propagate and break the side-effect pipeline.

---

Nitpick comments:
In `@packages/features/bookings/lib/BookingEmailSmsHandler.ts`:
- Around line 131-136: Extract the repeated UTC conversion of
originalRescheduledBooking start/end times into a single helper (e.g., a private
method on BookingEmailSmsHandler such as
formatBookingTimesToUtc(originalBooking) that returns { previousStartTime,
previousEndTime } where each value is computed with dayjs(...).utc().format() or
undefined) and replace the duplicated blocks in both reschedule handlers (the
places referencing originalRescheduledBooking) to call that helper so behavior
is centralized and consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: be17a3c7-ffe0-4c46-8e2e-fc59156f9019

📥 Commits

Reviewing files that changed from the base of the PR and between 2911168 and 2f769a8.

📒 Files selected for processing (3)
  • packages/emails/src/components/WhenInfo.tsx
  • packages/features/bookings/lib/BookingEmailSmsHandler.ts
  • packages/types/Calendar.d.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email ✨ feature New feature or request 🧹 Improvements Improvements to existing features. Mostly UX/UI Low priority Created by Linear-GitHub Sync size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rescheduled meeting email: include originally scheduled time

1 participant