Skip to content

Commit a14bc75

Browse files
style: cargo fmt
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d8bfea7 commit a14bc75

3 files changed

Lines changed: 74 additions & 36 deletions

File tree

src/commands/booking.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,16 @@ pub async fn run(pool: &SqlitePool, key: &[u8; 32], cmd: BookingCommands) -> Res
342342
.await?;
343343

344344
match booking {
345-
Some((full_id, uid, guest_name, guest_email, start_at, end_at, event_title, guest_timezone)) => {
345+
Some((
346+
full_id,
347+
uid,
348+
guest_name,
349+
guest_email,
350+
start_at,
351+
end_at,
352+
event_title,
353+
guest_timezone,
354+
)) => {
346355
let reason_input =
347356
prompt("Reason for cancellation (optional, press Enter to skip)");
348357
let reason = if reason_input.is_empty() {

src/email.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,18 @@ fn sanitize_ics(value: &str) -> String {
179179

180180
/// Convert date + start/end times from a guest timezone to UTC ICS format (YYYYMMDDTHHMMSSZ).
181181
/// Falls back to floating time (no Z) if timezone parsing fails.
182-
fn convert_to_utc(date: &str, start_time: &str, end_time: &str, timezone: &str) -> (String, String) {
182+
fn convert_to_utc(
183+
date: &str,
184+
start_time: &str,
185+
end_time: &str,
186+
timezone: &str,
187+
) -> (String, String) {
183188
let fallback_start = format!(
184189
"{}T{}00",
185190
date.replace('-', ""),
186191
start_time.replace(':', "")
187192
);
188-
let fallback_end = format!(
189-
"{}T{}00",
190-
date.replace('-', ""),
191-
end_time.replace(':', "")
192-
);
193+
let fallback_end = format!("{}T{}00", date.replace('-', ""), end_time.replace(':', ""));
193194

194195
let tz: Tz = match timezone.parse() {
195196
Ok(t) => t,

src/web/mod.rs

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,11 +1145,20 @@ async fn cancel_booking(
11451145
.await
11461146
.unwrap_or(None);
11471147

1148-
let (bid, uid, guest_name, guest_email, start_at, end_at, event_title, _account_id, guest_timezone) =
1149-
match booking {
1150-
Some(b) => b,
1151-
None => return Redirect::to("/dashboard/bookings").into_response(),
1152-
};
1148+
let (
1149+
bid,
1150+
uid,
1151+
guest_name,
1152+
guest_email,
1153+
start_at,
1154+
end_at,
1155+
event_title,
1156+
_account_id,
1157+
guest_timezone,
1158+
) = match booking {
1159+
Some(b) => b,
1160+
None => return Redirect::to("/dashboard/bookings").into_response(),
1161+
};
11531162

11541163
// Cancel the booking
11551164
let _ = sqlx::query("UPDATE bookings SET status = 'cancelled' WHERE id = ?")
@@ -6429,21 +6438,30 @@ async fn decline_booking_by_token(
64296438
.await
64306439
.unwrap_or(None);
64316440

6432-
let (bid, guest_name, guest_email, start_at, end_at, event_title, host_name, host_email, guest_timezone) =
6433-
match booking {
6434-
Some(b) => b,
6435-
None => {
6436-
let tmpl = state
6437-
.templates
6438-
.get_template("booking_action_error.html")
6439-
.unwrap();
6440-
let rendered = tmpl.render(context! {
6441+
let (
6442+
bid,
6443+
guest_name,
6444+
guest_email,
6445+
start_at,
6446+
end_at,
6447+
event_title,
6448+
host_name,
6449+
host_email,
6450+
guest_timezone,
6451+
) = match booking {
6452+
Some(b) => b,
6453+
None => {
6454+
let tmpl = state
6455+
.templates
6456+
.get_template("booking_action_error.html")
6457+
.unwrap();
6458+
let rendered = tmpl.render(context! {
64416459
title => "Invalid link",
64426460
message => "This decline link is invalid, has expired, or the booking has already been processed.",
64436461
}).unwrap_or_else(|e| format!("Template error: {}", e));
6444-
return Html(rendered).into_response();
6445-
}
6446-
};
6462+
return Html(rendered).into_response();
6463+
}
6464+
};
64476465

64486466
// Decline the booking
64496467
let _ = sqlx::query("UPDATE bookings SET status = 'declined' WHERE id = ?")
@@ -6597,23 +6615,33 @@ async fn guest_cancel_booking(
65976615
.await
65986616
.unwrap_or(None);
65996617

6600-
let (bid, uid, guest_name, guest_email, start_at, end_at, event_title, host_name, host_email, guest_timezone) =
6601-
match booking {
6602-
Some(b) => b,
6603-
None => {
6604-
let tmpl = state
6605-
.templates
6606-
.get_template("booking_action_error.html")
6607-
.unwrap();
6608-
let rendered = tmpl
6618+
let (
6619+
bid,
6620+
uid,
6621+
guest_name,
6622+
guest_email,
6623+
start_at,
6624+
end_at,
6625+
event_title,
6626+
host_name,
6627+
host_email,
6628+
guest_timezone,
6629+
) = match booking {
6630+
Some(b) => b,
6631+
None => {
6632+
let tmpl = state
6633+
.templates
6634+
.get_template("booking_action_error.html")
6635+
.unwrap();
6636+
let rendered = tmpl
66096637
.render(context! {
66106638
title => "Invalid link",
66116639
message => "This cancellation link is invalid, has expired, or the booking has already been cancelled.",
66126640
})
66136641
.unwrap_or_else(|e| format!("Template error: {}", e));
6614-
return Html(rendered).into_response();
6615-
}
6616-
};
6642+
return Html(rendered).into_response();
6643+
}
6644+
};
66176645

66186646
// Cancel the booking
66196647
let _ = sqlx::query("UPDATE bookings SET status = 'cancelled' WHERE id = ?")

0 commit comments

Comments
 (0)