mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-04 00:14:12 +00:00
fix: list a repeating event under its own title in calendar search when one occurrence was renamed
This commit is contained in:
@@ -60,6 +60,17 @@ describe('useCalendarEventSearch (CAL-16)', () => {
|
||||
expect(result.current?.past.map((e) => e.id)).toEqual(['old', 'older']);
|
||||
});
|
||||
|
||||
it('shows a series under its own title when its next occurrence was renamed', () => {
|
||||
const { client } = clientWith(() => new Promise(() => {}));
|
||||
const series = [
|
||||
makeEvent('sync-1', 'Sync edited', '2026-10-29T10:00:00', { uid: 'sync', recurrenceId: '2026-10-29T10:00:00' }),
|
||||
makeEvent('sync-2', 'Sync', '2026-11-05T10:00:00', { uid: 'sync', recurrenceId: '2026-11-05T10:00:00' }),
|
||||
makeEvent('sync-3', 'Sync', '2026-11-12T10:00:00', { uid: 'sync', recurrenceId: '2026-11-12T10:00:00' }),
|
||||
];
|
||||
const { result } = renderHook(() => useCalendarEventSearch('sync', client, series));
|
||||
expect(result.current?.upcoming.map((e) => e.id)).toEqual(['sync-1', 'sync-2']);
|
||||
});
|
||||
|
||||
it('keeps the loaded matches when the server can not search', async () => {
|
||||
const { client } = clientWith(async () => { throw new Error('unsupportedFilter'); });
|
||||
const { result } = renderHook(() => useCalendarEventSearch('review', client, loaded));
|
||||
|
||||
@@ -22,8 +22,11 @@ export interface CalendarSearchResults {
|
||||
}
|
||||
|
||||
// One row per event: a series found as loaded occurrences and as the
|
||||
// server's base event shows once.
|
||||
const seriesKey = (event: CalendarEvent) => `${event.accountId ?? ""} ${event.uid || event.originalId || event.id}`;
|
||||
// server's base event shows once. An occurrence renamed on its own gets a
|
||||
// row of its own, so the series still shows under its own title: the next
|
||||
// occurrence being the renamed one hid the series.
|
||||
const seriesKey = (event: CalendarEvent) =>
|
||||
`${event.accountId ?? ""} ${event.uid || event.originalId || event.id} ${event.title ?? ""}`;
|
||||
|
||||
/**
|
||||
* Searches the user's events by title, place, description and participants
|
||||
|
||||
Reference in New Issue
Block a user