mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-01 16:12:02 +00:00
Stalwart 1.0 enforces maxParticipantsPerEvent (20 by default) on every CalendarEvent create and update, answers to invitations included, and refuses anything over it with invalidProperties "An event cannot have more than 20 participants.". 0.16 advertises the same value but never enforced it. Creating, editing, moving or answering a bigger meeting failed with a generic "Failed to save event". - read the limit from the calendars account capability and warn in the event editor when the attendees go over it, without blocking the save - name the limit, and that an administrator can raise it, when the server refuses a create, edit, move, resize or answer for it, in the calendar and in the invitation banner - keep the SetError type on refused event creates and updates
21 lines
970 B
TypeScript
21 lines
970 B
TypeScript
import { renderHook } from '@testing-library/react';
|
|
import { describe, it, expect } from 'vitest';
|
|
import { useCalendarErrorMessage } from '../use-calendar-error-message';
|
|
import { jmapSetError } from '@/lib/jmap/jmap-error';
|
|
|
|
describe('useCalendarErrorMessage', () => {
|
|
it('names the participant limit when Stalwart 1.0 refused a change for it', () => {
|
|
const { result } = renderHook(() => useCalendarErrorMessage());
|
|
const refusal = jmapSetError('An event cannot have more than 20 participants.', {
|
|
type: 'invalidProperties', properties: ['participants'],
|
|
});
|
|
// next-intl is mocked to answer with the key.
|
|
expect(result.current(refusal, 'Failed to save event')).toBe('participant_limit');
|
|
});
|
|
|
|
it('falls back for any other failure', () => {
|
|
const { result } = renderHook(() => useCalendarErrorMessage());
|
|
expect(result.current(new Error('Request failed: 503'), 'Failed to save event')).toBe('Failed to save event');
|
|
});
|
|
});
|