fix: stop asking for the Stalwart principal on every start and message open

Every sign-in and app start read the account's full name with
`x:Account/get`, and the first message opened (invitation or not)
looked up the account aliases with it too. Stalwart refuses that method
to everyone but admins, so for most users both were wasted requests
that always came back `forbidden`, and the full name was never
refreshed.

- The full name now comes from `x:AccountSettings/get` (its
  `description`), which every user can read, like the webmail (#900).
- The alias lookup only runs for a message that carries a calendar
  invitation (and the calendar).
- A refusal of `x:Account/get` is remembered per account for the
  session, so it is asked at most once.
This commit is contained in:
Linus Rath
2026-09-24 20:20:58 +02:00
parent 018accd865
commit 3bf2c30c99
6 changed files with 190 additions and 20 deletions
@@ -68,11 +68,10 @@ export function CalendarInvitationBanner({ email, jmapAccountId }: Props) {
const subscriptions = useCalendarSubscriptionsStore((s) => s.subscriptions);
const importEvents = useCalendarStore((s) => s.importEvents);
const rsvpEvent = useCalendarStore((s) => s.rsvpEvent);
// Login address + identities + aliases, so invitations addressed to an
// alias still show the RSVP buttons.
const currentUserEmails = useUserCalendarAddresses();
const attachment = React.useMemo(() => findCalendarAttachment(email), [email]);
// Login address + identities + aliases, so invitations addressed to an
// alias still show the RSVP buttons. Only an invitation looks the aliases up.
const currentUserEmails = useUserCalendarAddresses(!!attachment && enabled);
const [state, setState] = React.useState<BannerState>('loading');
const [event, setEvent] = React.useState<Partial<CalendarEvent> | null>(null);