mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-23 05:54:48 -06:00
fix: treat a non-numeric calendar alert_minutes as unset (#28790)
A calendar event's `meta` is a free-form dict, so `meta.alert_minutes` can hold any JSON type, while the upcoming-events lookup assumed it was a number and compared it directly. It now ignores a value that is not numeric and falls back to the default alert window for that event. Handled on the read side rather than on the write path so events already stored with a non-numeric value are covered too. Numeric values are untouched, including the negative "no alert" sentinel.
This commit is contained in:
@@ -734,10 +734,10 @@ class CalendarEventTable:
|
||||
events = []
|
||||
for event, tz in rows:
|
||||
model = CalendarEventModel.model_validate(event)
|
||||
# Determine per-event alert window
|
||||
alert_minutes = None
|
||||
if model.meta and 'alert_minutes' in model.meta:
|
||||
alert_minutes = model.meta['alert_minutes']
|
||||
# meta is user-writable and this poll is shared by every user.
|
||||
alert_minutes = (model.meta or {}).get('alert_minutes')
|
||||
if not isinstance(alert_minutes, (int, float)):
|
||||
alert_minutes = None
|
||||
|
||||
if alert_minutes is not None:
|
||||
if alert_minutes < 0:
|
||||
|
||||
Reference in New Issue
Block a user