mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 16:13:15 +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
18 lines
644 B
TypeScript
18 lines
644 B
TypeScript
"use client";
|
|
|
|
import { useCallback } from "react";
|
|
import { useTranslations } from "next-intl";
|
|
import { participantLimitOf } from "@/lib/calendar-participants";
|
|
|
|
/**
|
|
* The message for a failed calendar change: why the server refused it when
|
|
* that is something the user can act on, `fallback` otherwise.
|
|
*/
|
|
export function useCalendarErrorMessage(): (error: unknown, fallback: string) => string {
|
|
const t = useTranslations("calendar.notifications");
|
|
return useCallback((error: unknown, fallback: string) => {
|
|
const max = participantLimitOf(error);
|
|
return max === null ? fallback : t("participant_limit", { max });
|
|
}, [t]);
|
|
}
|