mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 19:22:26 +00:00
fix: Add timezone-id support to mkcalendar
This commit is contained in:
@@ -82,12 +82,25 @@ pub async fn route_mkcalendar<C: CalendarStore, S: SubscriptionStore>(
|
|||||||
request.displayname = None
|
request.displayname = None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut timezone = request.calendar_timezone;
|
||||||
|
if let Some(tzid) = request.calendar_timezone_id.as_ref() {
|
||||||
|
// Validate timezone id and set timezone accordingly
|
||||||
|
timezone = Some(
|
||||||
|
vzic_rs::VTIMEZONES
|
||||||
|
.get(tzid)
|
||||||
|
.ok_or(rustical_dav::Error::BadRequest(format!(
|
||||||
|
"Invalid timezone-id: {tzid}"
|
||||||
|
)))?
|
||||||
|
.to_string(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let calendar = Calendar {
|
let calendar = Calendar {
|
||||||
id: cal_id.to_owned(),
|
id: cal_id.to_owned(),
|
||||||
principal: principal.to_owned(),
|
principal: principal.to_owned(),
|
||||||
order: request.calendar_order.unwrap_or(0),
|
order: request.calendar_order.unwrap_or(0),
|
||||||
displayname: request.displayname,
|
displayname: request.displayname,
|
||||||
timezone: request.calendar_timezone,
|
timezone,
|
||||||
timezone_id: request.calendar_timezone_id,
|
timezone_id: request.calendar_timezone_id,
|
||||||
color: request.calendar_color,
|
color: request.calendar_color,
|
||||||
description: request.calendar_description,
|
description: request.calendar_description,
|
||||||
|
|||||||
Reference in New Issue
Block a user