From 072b3d0c3ddaa8cd3201238b56a0f5645322bc61 Mon Sep 17 00:00:00 2001 From: mAi Date: Wed, 20 May 2026 14:42:20 +0200 Subject: [PATCH] fix(events): drop broken 'From Today' appointment filter; default to today MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit m/paliad#54 (t-paliad-221) — fix 92780cf added a status=upcoming option for appointments and made it the default, but DeadlineFilterUpcoming only narrowed deadlines. The appointment query had no matching case, so the bucket fell through to the unfiltered path and past events leaked into "Ab heute" / "From today". - Drop the 'upcoming' option from STATUS_OPTIONS_APPOINTMENT — confusing label that never delivered. - Default appointments to the 'today' bucket (matches the dashboard tile; sane lawyer-relevant view). - Keep 'Alle (auch vergangene)' as the explicit opt-in at the bottom of the list. - Defensive backend fix: map DeadlineFilterUpcoming to start_at >= today in bucketAppointmentWindow so any persisted ?status=upcoming bookmarks stop leaking past events. --- frontend/src/client/events.ts | 7 +++++-- internal/services/event_service.go | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/frontend/src/client/events.ts b/frontend/src/client/events.ts index 1d01f67..a78a7eb 100644 --- a/frontend/src/client/events.ts +++ b/frontend/src/client/events.ts @@ -125,8 +125,11 @@ const STATUS_OPTIONS_DEADLINE: StatusOption[] = [ { value: "completed", key: "deadlines.filter.completed" }, ]; +// Appointment status options — m/paliad#54: the legacy 'upcoming' / +// "Ab heute" option was a UI lie (backend never narrowed past events for +// appointments) and is removed. 'today' is the sane default — matches the +// dashboard tile. 'all' stays as the explicit opt-in for past events. const STATUS_OPTIONS_APPOINTMENT: StatusOption[] = [ - { value: "upcoming", key: "events.filter.status.upcoming" }, { value: "today", key: "deadlines.filter.today" }, { value: "this_week", key: "deadlines.filter.thisweek" }, { value: "next_week", key: "deadlines.filter.nextweek" }, @@ -140,7 +143,7 @@ function statusOptionsFor(type: EventTypeChoice): StatusOption[] { } function defaultStatusFor(type: EventTypeChoice): string { - return type === "appointment" ? "upcoming" : "pending"; + return type === "appointment" ? "today" : "pending"; } let currentType: EventTypeChoice = "deadline"; diff --git a/internal/services/event_service.go b/internal/services/event_service.go index e525da5..4639f7c 100644 --- a/internal/services/event_service.go +++ b/internal/services/event_service.go @@ -279,7 +279,12 @@ func shouldExcludeAppointmentsForStatus(status DeadlineStatusFilter) bool { // matches a bucket-style deadline status — used to filter the // appointment side when the user clicks a card on the unified events // page. Returns (nil, nil) for non-bucket statuses (pending / all / -// upcoming / "" / overdue / completed — those are handled separately). +// "" / overdue / completed — those are handled separately). +// +// DeadlineFilterUpcoming maps to "start_at >= today" so legacy +// `?status=upcoming` URLs hide past appointments instead of falling +// through to the unfiltered query (m/paliad#54 — the UI option that +// surfaced this status has been removed, but bookmarks may persist). func bucketAppointmentWindow(status DeadlineStatusFilter, b deadlineBucketBounds) (*time.Time, *time.Time) { switch status { case DeadlineFilterToday: @@ -293,6 +298,8 @@ func bucketAppointmentWindow(status DeadlineStatusFilter, b deadlineBucketBounds return &b.nextMonday, &t case DeadlineFilterLater: return &b.weekAfter, nil + case DeadlineFilterUpcoming: + return &b.today, nil } return nil, nil }