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): name outlook calendars and hide organizer rsvp on cards (#8947)

teo966fdbfa1aca
diff --git a/apps/web/src/features/calendar-view/components/EventRsvpSection.test.tsx b/apps/web/src/features/calendar-view/components/EventRsvpSection.test.tsx
index c2d1b2352d..edd3c7231f 100644
--- a/apps/web/src/features/calendar-view/components/EventRsvpSection.test.tsx
+++ b/apps/web/src/features/calendar-view/components/EventRsvpSection.test.tsx
@@ -47,7 +47,7 @@ const event: CalendarEvent = {
isCancelled: false,
isReadOnly: false,
guestPolicy: DEFAULT_GUEST_POLICY,
- viewerCan: NO_VIEWER_CAPABILITIES,
+ viewerCan: { ...NO_VIEWER_CAPABILITIES, rsvp: true },
sourceCalendarIds: [],
recurrenceLines: ['RRULE:FREQ=WEEKLY'],
title: 'Team meeting',
@@ -117,7 +117,15 @@ describe('event RSVP confirmation', () => {
expect(mutate).toHaveBeenCalledOnce();
});
it('offers no answer on a snapshot of a shared event', () => {
- render(() => <EventRsvpSection event={{ ...event, isSnapshot: true }} />);
+ render(() => (
+ <EventRsvpSection
+ event={{
+ ...event,
+ isSnapshot: true,
+ viewerCan: NO_VIEWER_CAPABILITIES,
+ }}
+ />
+ ));
expect(screen.queryByText('Going?')).toBeNull();
expect(screen.queryByText('Yes')).toBeNull();
});
diff --git a/apps/web/src/features/calendar-view/components/EventRsvpSection.tsx b/apps/web/src/features/calendar-view/components/EventRsvpSection.tsx
index d07e0c63eb..467409e621 100644
--- a/apps/web/src/features/calendar-view/components/EventRsvpSection.tsx
+++ b/apps/web/src/features/calendar-view/components/EventRsvpSection.tsx
@@ -37,13 +37,10 @@ export function EventRsvpSection(props: {
const isRecurring = () =>
props.event.recurrenceLines.length > 0 ||
props.event.recurrenceId !== undefined;
- // A snapshot lists the viewer only so Google would take the copy; an answer
- // there would never reach the organizer.
const canRespond = () =>
+ props.event.viewerCan.rsvp &&
selfAttendee() !== undefined &&
- !props.event.isReadOnly &&
- !props.event.isCancelled &&
- !props.event.isSnapshot;
+ !props.event.isCancelled;
const rsvp = createCalendarRsvpController(() =>
canRespond()
@@ -98,12 +95,7 @@ export function EventRsvpSection(props: {
)}
</Show>
</div>
- <Show
- when={
- props.event.calendar.provider === 'outlook' &&
- !selfAttendee()?.isOrganizer
- }
- >
+ <Show when={props.event.calendar.provider === 'outlook'}>
<OutlookRsvpAction
target={{
eventId: props.event.eventId,
diff --git a/apps/web/src/features/calendar/utils/calendar-label.ts b/apps/web/src/features/calendar/utils/calendar-label.ts
index b57197919d..23f7033dca 100644
--- a/apps/web/src/features/calendar/utils/calendar-label.ts
+++ b/apps/web/src/features/calendar/utils/calendar-label.ts
@@ -1,5 +1,5 @@
import type { VisibleCalendar } from '@queries/calendar/calendars';
-import type { CalendarPeriodView } from '../types';
+import type { CalendarPeriodView, CalendarSource } from '../types';
const CALENDAR_PERIOD_LABELS = {
dayGridMonth: 'Month',
@@ -13,20 +13,22 @@ export function calendarPeriodLabel(view: CalendarPeriodView): string {
}
/**
- * Display label for a calendar in pickers and filters. Google names primary
- * calendars after the account email, so primaries collapse to the inbox
- * address; other calendars carry their inbox only when the visible set spans
- * more than one account.
+ * Display label for a calendar in pickers, filters and event details. Google
+ * names primary calendars after the account email and Outlook names its
+ * default one "Calendar", so primaries collapse to the inbox address; other
+ * calendars carry their inbox only when the visible set spans more than one
+ * account.
*/
export function calendarDisplayLabel(
- calendar: Pick<VisibleCalendar, 'name' | 'emailAddress' | 'isPrimary'>,
+ calendar: Pick<CalendarSource, 'name' | 'emailAddress' | 'isPrimary'>,
spansInboxes: boolean
): string {
- if (calendar.isPrimary || calendar.name === calendar.emailAddress) {
- return calendar.emailAddress;
+ const { emailAddress } = calendar;
+ if (emailAddress && (calendar.isPrimary || calendar.name === emailAddress)) {
+ return emailAddress;
}
- return spansInboxes
- ? `${calendar.name} — ${calendar.emailAddress}`
+ return spansInboxes && emailAddress
+ ? `${calendar.name} — ${emailAddress}`
: calendar.name;
}
diff --git a/apps/web/src/features/calendar/utils/event-attribution.test.ts b/apps/web/src/features/calendar/utils/event-attribution.test.ts
index d545dc86cf..85ddc52ca2 100644
--- a/apps/web/src/features/calendar/utils/event-attribution.test.ts
+++ b/apps/web/src/features/calendar/utils/event-attribution.test.ts
@@ -45,7 +45,7 @@ describe('eventAttribution', () => {
})
);
- expect(attribution.calendarName).toBe('Jackson Kustec');
+ expect(attribution.calendarName).toBe('[email protected]');
expect(attribution.creator).toEqual({
displayName: 'Teo Nys',
@@ -62,7 +62,7 @@ describe('eventAttribution', () => {
})
);
- expect(attribution.calendarName).toBe('Jackson Kustec');
+ expect(attribution.calendarName).toBe('[email protected]');
expect(attribution.creator).toBeUndefined();
expect(attribution.organizer).toBeUndefined();
});
diff --git a/apps/web/src/features/calendar/utils/event-attribution.ts b/apps/web/src/features/calendar/utils/event-attribution.ts
index 528d5a915d..29e95b77e4 100644
--- a/apps/web/src/features/calendar/utils/event-attribution.ts
+++ b/apps/web/src/features/calendar/utils/event-attribution.ts
@@ -1,4 +1,5 @@
import type { CalendarEvent, CalendarSource } from '../types';
+import { calendarDisplayLabel } from './calendar-label';
/** A person attributed on an event: organizer or creator. */
export interface CalendarPerson {
@@ -101,7 +102,7 @@ export function eventAttribution(event: CalendarEvent): EventAttribution {
organizer !== undefined && !sameAsCalendar(organizer, event.calendar);
return {
- calendarName: event.calendar.name || 'Calendar',
+ calendarName: calendarDisplayLabel(event.calendar, false) || 'Calendar',
creator: showCreator ? creator : undefined,
organizer: showOrganizer ? organizer : undefined,
};
diff --git a/crates/calendar_events/AGENTS.md b/crates/calendar_events/AGENTS.md
index 3c6a5718cb..8ef1c70ae0 100644
--- a/crates/calendar_events/AGENTS.md
+++ b/crates/calendar_events/AGENTS.md
@@ -81,7 +81,9 @@ reminder dispatch, team availability, and provider/Postgres persistence.
copy lacks the guests it would drop. Microsoft Graph has no attendee-side
write either: an Outlook organizer adds guests with the same full-list write
(`email_api_client`'s `outlook/calendar/invite.rs`), and an Outlook guest may
- only answer (`guests_cannot_invite`).
+ only answer (`guests_cannot_invite`). An Outlook organizer may not answer:
+ Graph fixes the organizer's response, so `ViewerCapabilities::rsvp` is false
+ and the adapter refuses an answer with `NotAttendee`.
- A guest without `edit_details` may change only what Google keeps on each
guest's copy (reminders, availability) and add guests where allowed:
`update_event` drops details the patch repeats at their stored value
diff --git a/crates/calendar_events/src/domain/capabilities.rs b/crates/calendar_events/src/domain/capabilities.rs
index ff172a0a5d..5c38d299fb 100644
--- a/crates/calendar_events/src/domain/capabilities.rs
+++ b/crates/calendar_events/src/domain/capabilities.rs
@@ -103,9 +103,11 @@ impl ViewerCapabilities {
/// it would never reach the meeting. The organizer may do
/// everything, and so may anyone on a writable event without attendees,
/// which is treated as the actor's own, except that only a Google copy
- /// has a guest policy to set. A guest of a Google copy follows
- /// the event's [`GuestPolicy`]: modify allows everything except changing
- /// the policy, invite allows adding guests, and every guest may answer.
+ /// has a guest policy to set, and only a Google organizer may answer:
+ /// Outlook fixes the organizer's response and refuses their answer. A
+ /// guest of a Google copy follows the event's [`GuestPolicy`]: modify
+ /// allows everything except changing the policy, invite allows adding
+ /// guests, and every guest may answer.
/// A guest may change the guest list only while it is visible: Google
/// takes guest additions as a whole new list, and a guest's copy of a
/// hidden list holds only themselves and the organizer. Outlook gives
@@ -161,13 +163,13 @@ impl ViewerCapabilities {
.any(|attendee| attendee.is_organizer && inbox.matches(&attendee.email))
});
if is_organizer || access.attendees.is_empty() {
+ let is_google = inbox.is_some_and(|inbox| inbox.provider == CalendarProvider::Google);
return Self {
edit_details: true,
invite_guests: true,
remove_guests: true,
- set_guest_policy: inbox
- .is_some_and(|inbox| inbox.provider == CalendarProvider::Google),
- rsvp: is_guest,
+ set_guest_policy: is_google,
+ rsvp: is_guest && is_google,
organize: true,
};
}
diff --git a/crates/calendar_events/src/domain/capabilities/test.rs b/crates/calendar_events/src/domain/capabilities/test.rs
index 2ea17cd730..6830055bc7 100644
--- a/crates/calendar_events/src/domain/capabilities/test.rs
+++ b/crates/calendar_events/src/domain/capabilities/test.rs
@@ -385,7 +385,7 @@ fn an_outlook_guest_copy_of_a_google_meeting_may_only_answer() {
}
#[test]
-fn an_outlook_organizer_copy_may_do_everything_but_set_a_guest_policy() {
+fn an_outlook_organizer_copy_may_do_everything_but_set_a_guest_policy_or_answer() {
let mut copy = event(
vec![attendee(OUTLOOK, true), attendee(GUEST, false)],
GuestPolicy::default(),
@@ -398,9 +398,10 @@ fn an_outlook_organizer_copy_may_do_everything_but_set_a_guest_policy() {
copy.viewer_can,
ViewerCapabilities {
set_guest_policy: false,
+ rsvp: false,
..EVERYTHING
},
- "Outlook has no guest policy, but its organizer still organizes"
+ "Outlook has no guest policy and refuses an answer from the organizer, who still organizes"
);
}
diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.md
index c34e0dbf13..690d3236b7 100644
--- a/docs/agent-guide/calendar.md
+++ b/docs/agent-guide/calendar.md
@@ -556,7 +556,9 @@ provider does not report the stored ones. Timed and all-day events use solid cal
blocks with dark text on desktop and mobile. Unanswered and tentative invitations have
lighter fills; declined events are desaturated and struck through. Month-view timed events
keep their compact dot treatment. Out-of-office details show an `Out of office` line under
-the schedule.
+the schedule. The details' calendar row names the calendar the event is on. A primary
+calendar reads as its inbox address, as in the calendar pickers, because Outlook names an
+account's default calendar `Calendar`. Other calendars show their name.
An event that Google carries on several of an account's calendars (a shared calendar's
re-import of a member's own event, for example) renders as one chip, not one per calendar:
the details popover's color square shows its calendars. The chip shows the title, color, and
@@ -621,8 +623,9 @@ guest copy stays a guest copy, marked `(you)` on that inbox's row alone, even wh
another connected inbox organizes the event. An Outlook guest copy never offers `Add
guests` (Outlook lets only the organizer change a meeting) and shows the same
explanation; an Outlook organizer adds guests like a Google one. The organizer's row on an
-Outlook event shows `Accepted` and `Going?` has `Yes` pressed, as on Google, although
-Microsoft lists the organizer as not having answered.
+Outlook event shows `Accepted`, as on Google, although Microsoft lists the organizer as not
+having answered. Microsoft refuses an organizer's answer, so an Outlook organizer gets no
+`Going?` footer (`viewerCan.rsvp` is false), while a Google organizer listed as a guest does.
A guest the organizer does not let modify the event (`viewerCan.editDetails` false while
`viewerCan.rsvp` is true) opens an editor whose date/time, all-day, title, description,
repeat, conferencing and location controls are disabled, each with the tooltip `Only the