From e6340837f1b74b237333b381d672041430786e3a Mon Sep 17 00:00:00 2001 From: belviskhoremk Date: Wed, 20 May 2026 23:56:37 +0000 Subject: [PATCH] Fix booking status update failing when SMTP not configured --- app/services/booking_service.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/services/booking_service.py b/app/services/booking_service.py index 2894287..d4816ef 100644 --- a/app/services/booking_service.py +++ b/app/services/booking_service.py @@ -185,11 +185,14 @@ async def admin_update_booking( if email: slot = await db.fetchrow("SELECT date, start_time FROM time_slots WHERE id = $1", str(booking["slot_id"])) if slot: - from app.services import email_service - if status == "confirmed": - await email_service.send_booking_confirmed(email, str(slot["date"]), _fmt_time(slot["start_time"])) - elif status == "cancelled": - await email_service.send_booking_cancelled(email, str(slot["date"]), _fmt_time(slot["start_time"])) + try: + from app.services import email_service + if status == "confirmed": + await email_service.send_booking_confirmed(email, str(slot["date"]), _fmt_time(slot["start_time"])) + elif status == "cancelled": + await email_service.send_booking_cancelled(email, str(slot["date"]), _fmt_time(slot["start_time"])) + except Exception: + pass # Email failure must not block the status update await _log(db, actor_id, f"booking.{status}", "booking", booking_id) return await get_booking(db, booking_id)