fix(notifications): drop a tab the planner lacks from the URL, link booking mails to the reservations tab, open the chat on the phone

This commit is contained in:
Maurice
2026-11-14 16:49:18 +01:00
parent bfdbf4d811
commit a76a96ccca
9 changed files with 61 additions and 16 deletions
@@ -118,6 +118,16 @@ describe('useNotificationItemActions', () => {
expect(navigate).toHaveBeenLastCalledWith('/dashboard');
});
it('FE-COMP-NOTIFITEM-ACTIONS-006: an old booking mail link names the reservations tab by its id', async () => {
const { result } = renderHook(() =>
useNotificationItemActions(
notification({ title_key: 'notif.mail_booking_added.title', navigate_target: '/trips/7?tab=bookings' })
)
);
await act(() => result.current.handleNavigate());
expect(navigate).toHaveBeenLastCalledWith('/trips/7?tab=buchungen');
});
it('FE-COMP-NOTIFITEM-ACTIONS-002: navigating marks an unread item read first, then follows and closes', async () => {
const onClose = vi.fn();
const { result } = renderHook(() => useNotificationItemActions(notification(), onClose));
@@ -14,7 +14,8 @@ function notificationTarget(notification: InAppNotification): string | null {
(notification.scope === 'trip' && notification.target > 0 ? String(notification.target) : null);
return tripId ? `/trips/${tripId}?tab=collab` : '/dashboard';
}
return notification.navigate_target;
// Booking mails used to link a tab by its English name, which the planner does not have.
return notification.navigate_target?.replace(/([?&]tab=)bookings(?=&|#|$)/, '$1buchungen') ?? null;
}
/** Compact relative timestamp ("5m" / "3h" / "2d"); under a minute it reads `justNow`. */