Shared calendars in the calendar, and no more account switcher
Three things from using it on two real accounts. A calendar shared with you never appeared. Nothing was wrong with the share -- the calendar had nowhere to be shown. Calendars loaded from one account and one only, so the sharer's were reachable solely by switching the whole app to their account, which is the door being closed below. They now sit under "Shared with me" beside the reader's own, in their own colour, with their events in the grid and a click to hide them like any other calendar. Their events go through `instancesIn`, the one funnel every view already reads, so month, week, day and agenda got them without being touched. Events and calendars from another account are keyed by account as well as id, and hiding one is remembered under the same key: an id means nothing outside the account holding it, and two accounts sharing an id is ordinary rather than unlucky. An account that shared nothing was listed in Files as though it had. Every non-personal account was offered on the reasoning that its folders could speak for themselves -- but an account whose *calendar* was shared has no folders to speak with, and appeared as an invitation to open an empty pane. Each is now asked for one file before being listed, and silence is taken for an answer. And the account switcher is gone from the profile menu. It existed to reach what other people shared and was the wrong door: it moved the whole app to somebody else's account, and since Stalwart advertises every capability on a shared account, mail, calendar and contacts went with it and were refused. Everything it was for is now in the module the share belongs to, found without anyone needing to know an account was involved. What this does not prove is that Stalwart delivers a calendar share at all. The mock says the client handles one, which is the half that was missing; whether the server behaves like address books, which work, or like mail folders, which do not, needs the two accounts again.
This commit is contained in:
+19
-6
@@ -133,14 +133,27 @@ export const useFiles = create<FilesState>((set, get) => ({
|
||||
* Which accounts hold shared files cannot be worked out from capabilities:
|
||||
* Stalwart advertises the whole set on a shared account -- mail, calendars,
|
||||
* contacts and the rest -- identical to a personal one, whatever was
|
||||
* actually shared (checked on 0.16.19, 2026-08-27). So every account that
|
||||
* is not the reader's own is offered, and what it really holds is settled
|
||||
* by asking it for its folders and showing what comes back.
|
||||
* actually shared (checked on 0.16.19, 2026-08-27). So each one is asked
|
||||
* for its files, and only the ones that answer with any are listed.
|
||||
*
|
||||
* Listing them all and letting the folders speak for themselves was the
|
||||
* first attempt, and it put an account holding nothing at all under
|
||||
* "Shared with me" -- an invitation to open an empty pane, offered by an
|
||||
* account whose calendar or contacts were the thing actually shared. An
|
||||
* account that shares no files does not belong in a list of shared files.
|
||||
*/
|
||||
const s = session.session;
|
||||
const sharedAccounts = Object.entries(s?.accounts ?? {})
|
||||
.filter(([, a]) => a.isPersonal === false)
|
||||
.map(([id, a]) => ({ id, name: a.name }));
|
||||
const candidates = Object.entries(s?.accounts ?? {}).filter(([, a]) => a.isPersonal === false);
|
||||
const sharedAccounts: SharedAccount[] = [];
|
||||
for (const [id, a] of candidates) {
|
||||
try {
|
||||
const res = await client.call<QueryResponse>("FileNode/query", { accountId: id, limit: 1 });
|
||||
if (res.ids.length) sharedAccounts.push({ id, name: a.name });
|
||||
} catch {
|
||||
// Refused means nothing here is ours to see, which is the same answer.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Stay where the reader is if they are reading a share that still exists.
|
||||
const browsing = get().accountId;
|
||||
const keep = browsing && (browsing === ownAccountId || sharedAccounts.some((a) => a.id === browsing));
|
||||
|
||||
Reference in New Issue
Block a user