Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(calendar): invite a recurring event's series by default and explain locked guest permissions (#8644)

gbirmanfb13fdc72996
diff --git a/apps/web/src/features/calendar-view/components/EventGuests.test.tsx b/apps/web/src/features/calendar-view/components/EventGuests.test.tsx
index eb7645f4bf..dda1fce0b0 100644
--- a/apps/web/src/features/calendar-view/components/EventGuests.test.tsx
+++ b/apps/web/src/features/calendar-view/components/EventGuests.test.tsx
@@ -179,7 +179,7 @@ afterEach(() => {
});
describe('adding guests from event details', () => {
- it('lists the current guests as fixed and invites an optional guest to the whole series', async () => {
+ it('lists the current guests as fixed and invites an optional guest to the whole series by default', async () => {
const user = userEvent.setup();
renderGuests(event({ recurrenceLines: ['RRULE:FREQ=WEEKLY'] }));
@@ -196,7 +196,6 @@ describe('adding guests from event details', () => {
screen.queryByRole('button', { name: 'Suggest Ada Lovelace' })
).toBeNull();
await user.click(screen.getByRole('checkbox', { name: 'Optional' }));
- await user.click(screen.getByRole('radio', { name: 'All events' }));
await user.click(screen.getByRole('button', { name: 'Send invitations' }));
expect(mocks.invite).toHaveBeenCalledWith({
@@ -241,6 +240,7 @@ describe('adding guests from event details', () => {
await user.click(
screen.getByRole('button', { name: 'Suggest Ada Lovelace' })
);
+ await user.click(screen.getByRole('radio', { name: 'This event' }));
screen.getByRole('textbox', { name: 'Search for guests' }).focus();
await user.keyboard('{Meta>}{Enter}{/Meta}');
diff --git a/apps/web/src/features/calendar-view/components/EventGuests.tsx b/apps/web/src/features/calendar-view/components/EventGuests.tsx
index 80cd2b4838..f7e191354f 100644
--- a/apps/web/src/features/calendar-view/components/EventGuests.tsx
+++ b/apps/web/src/features/calendar-view/components/EventGuests.tsx
@@ -62,7 +62,9 @@ function InviteGuestsForm(props: {
const [optionalIds, setOptionalIds] = createSignal<ReadonlySet<string>>(
new Set()
);
- const [scope, setScope] = createSignal<CalendarInviteScope>('this_event');
+ // A recurring event invites to the whole series unless the viewer narrows
+ // it, as the composer's edits do.
+ const [scope, setScope] = createSignal<CalendarInviteScope>('all');
const recurring = () =>
props.event.recurrenceLines.length > 0 ||
props.event.recurrenceId !== undefined;
diff --git a/apps/web/src/features/calendar/components/composer/EventForm.test.tsx b/apps/web/src/features/calendar/components/composer/EventForm.test.tsx
index 7de9730b5f..fcb11a396b 100644
--- a/apps/web/src/features/calendar/components/composer/EventForm.test.tsx
+++ b/apps/web/src/features/calendar/components/composer/EventForm.test.tsx
@@ -206,6 +206,21 @@ it('returns guest permissions to the stored ones when an edit targets one occurr
expect((seeGuests as HTMLInputElement).checked).toBe(true);
expect((seeGuests as HTMLInputElement).disabled).toBe(true);
+ expect(
+ screen.getByRole('group', {
+ name: 'Guest permissions',
+ description:
+ 'Guest permissions apply to all events. Choose All events to change them.',
+ })
+ ).toBeTruthy();
+
+ await user.click(screen.getByRole('radio', { name: 'All events' }));
+ expect((seeGuests as HTMLInputElement).disabled).toBe(false);
+ expect(
+ screen.queryByText(
+ 'Guest permissions apply to all events. Choose All events to change them.'
+ )
+ ).toBeNull();
});
it('moves the end with the start until the end is picked', async () => {
diff --git a/apps/web/src/features/calendar/components/composer/EventForm.tsx b/apps/web/src/features/calendar/components/composer/EventForm.tsx
index 143ee244f4..49f3045efe 100644
--- a/apps/web/src/features/calendar/components/composer/EventForm.tsx
+++ b/apps/web/src/features/calendar/components/composer/EventForm.tsx
@@ -413,6 +413,11 @@ export function EventForm(props: EventFormProps) {
value={controller.guestPolicy()}
onChange={controller.setGuestPolicy}
disabled={formIsDisabled() || editScope() === 'this_event'}
+ disabledReason={
+ editScope() === 'this_event'
+ ? 'Guest permissions apply to all events. Choose All events to change them.'
+ : undefined
+ }
/>
</Show>
<Show when={props.detailsReadOnlyReason}>
diff --git a/apps/web/src/features/calendar/components/composer/EventGuestPolicyRow.tsx b/apps/web/src/features/calendar/components/composer/EventGuestPolicyRow.tsx
index b21cd3f22c..f30f8706ae 100644
--- a/apps/web/src/features/calendar/components/composer/EventGuestPolicyRow.tsx
+++ b/apps/web/src/features/calendar/components/composer/EventGuestPolicyRow.tsx
@@ -1,6 +1,6 @@
import type { GuestPolicy } from '@service-storage/generated/schemas/guestPolicy';
import { Checkbox } from '@ui';
-import { createUniqueId, For } from 'solid-js';
+import { createUniqueId, For, Show } from 'solid-js';
/** Google Calendar's wording and order. */
const GUEST_PERMISSIONS = [
@@ -13,6 +13,8 @@ export interface EventGuestPolicyRowProps {
value: GuestPolicy;
onChange: (value: GuestPolicy) => void;
disabled?: boolean;
+ /** Why the switches cannot change, shown after them. */
+ disabledReason?: string;
}
/**
@@ -21,6 +23,7 @@ export interface EventGuestPolicyRowProps {
*/
export function EventGuestPolicyRow(props: EventGuestPolicyRowProps) {
const labelId = `event-guest-permissions-${createUniqueId()}`;
+ const reasonId = `${labelId}-reason`;
const change = (key: keyof GuestPolicy, checked: boolean) => {
const next = { ...props.value, [key]: checked };
if (next.canModify) next.canInviteOthers = true;
@@ -31,6 +34,7 @@ export function EventGuestPolicyRow(props: EventGuestPolicyRowProps) {
<div
role="group"
aria-labelledby={labelId}
+ aria-describedby={props.disabledReason ? reasonId : undefined}
class="flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1 text-xs text-ink-muted"
>
<span id={labelId} class="font-medium">
@@ -52,6 +56,13 @@ export function EventGuestPolicyRow(props: EventGuestPolicyRowProps) {
</Checkbox>
)}
</For>
+ <Show when={props.disabledReason}>
+ {(reason) => (
+ <span id={reasonId} class="text-ink-extra-muted">
+ {reason()}
+ </span>
+ )}
+ </Show>
</div>
);
}
diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.md
index 1e3c15c945..d315749d60 100644
--- a/docs/agent-guide/calendar.md
+++ b/docs/agent-guide/calendar.md
@@ -461,10 +461,11 @@ whenever the event's `viewerCan.inviteGuests` allows it, including for a guest w
organizer lets guests invite. It opens an editor anchored to the button (a bottom sheet on
phones): the current guests are listed under `Invited` without a remove control, the picker
adds people, each new guest has an `Optional` checkbox, a recurring event offers `This
-event` / `All events`, and `Send invitations` (or Cmd/Ctrl+Enter) sends them; Escape
-closes. The new guests appear at once as unanswered and a toast confirms the invitation
-once the provider accepts it. A guest who may not invite gets no button; instead the guest
-list opens with `Only the organizer can invite guests.`, and the same happens after the
+event` / `All events` (`All events` by default, like the editor's recurring edits), and
+`Send invitations` (or Cmd/Ctrl+Enter) sends them; Escape closes. The new guests appear at
+once as unanswered and a toast confirms the invitation once the provider accepts it. A
+guest who may not invite gets no button; instead the guest list opens with `Only the
+organizer can invite guests.`, and the same happens after the
provider refuses an invitation. In the event editor, the organizer edits guests as before,
while a guest who may invite gets an add-only guests pill whose additions are sent as an
invitation on save (other edits are saved first); a guest who may not invite keeps a
@@ -504,11 +505,13 @@ defaults (invite others and see the guest list) preselected on a new event and t
locks it. The row shows on a new event and on an edit whose `viewerCan.setGuestPolicy` is true,
on Google calendars only (the calendar's `capabilities.guestPolicy`); Outlook calendars and
out-of-office events have none. Like the repeat rule, it is disabled while a recurring edit
-targets `This event`, since the policy belongs to the whole series, and choosing `This event`
-returns it to the stored values. Save sends `guestPolicy` only when it changed, and the guests'
-`viewerCan` follows once their copies sync: turning `Invite others` off replaces a guest's
-`Add guests` with `Only the organizer can invite guests.` The update refuses a policy change
-from anyone but the organizer with 403 `not_organizer`, and on an Outlook event with
+targets `This event`, since the policy belongs to the whole series, and says so after the
+switches (`Guest permissions apply to all events. Choose All events to change them.`);
+choosing `This event` returns it to the stored values. Save sends `guestPolicy` only when it
+changed, and the guests' `viewerCan` follows once their copies sync: turning `Invite others`
+off replaces a guest's `Add guests` with `Only the organizer can invite guests.` The update
+refuses a policy change from anyone but the organizer with 403 `not_organizer`, and on an
+Outlook event with
`provider_rejected`. `viewerCan.organize` marks the organizer of the displayed copy, including
on Outlook, where `setGuestPolicy` is false.
The details header's `Download .ics` icon button, beside `Copy event`, saves the event as an