Ask for shareWith on mailboxes too
The third store fetching everything by asking for nothing. Same cause as the calendars and address books a commit ago: Stalwart does not return `shareWith` unless a client names it, so mail folders never looked shared either. This one has a narrow but real consequence. Sharing a mail folder is withdrawn, because Stalwart stores the share and never delivers it, and the only way left to clear one already made is the "Stop sharing" entry -- which appears only when a folder looks shared. Without the property it never did. The escape hatch built for exactly that situation could not be reached from the situation it was built for. Found by looking for the rest of them rather than waiting for the next report: `ids: null` with no `properties`, across the app. The others it turned up -- Sieve scripts, identities, the vacation response, quotas, participant identities, push subscriptions -- have no `shareWith` to lose, so mailboxes were the last. The mock hides it here as well now, so all three are honest.
This commit is contained in:
+27
-1
@@ -22,6 +22,32 @@ import { toast } from "@/ui/toast";
|
||||
import { settings, useSettings } from "./settings";
|
||||
import { useSession } from "./session";
|
||||
|
||||
/*
|
||||
* Named explicitly so `shareWith` comes back, which it does not otherwise --
|
||||
* see the note on CALENDAR_PROPS and the KNOWN-ISSUES entry. Mailboxes were the
|
||||
* third and last store fetching everything by asking for nothing.
|
||||
*
|
||||
* It matters here for one narrow but real case. Sharing a mail folder is
|
||||
* withdrawn because Stalwart stores the share and never delivers it, and the
|
||||
* only way left to clear one already made is the "Stop sharing" entry, which
|
||||
* appears only when a folder looks shared. Without this it never looked shared,
|
||||
* so the escape hatch for the exact situation it was built for was invisible.
|
||||
*/
|
||||
export const MAILBOX_PROPS = [
|
||||
"id",
|
||||
"name",
|
||||
"parentId",
|
||||
"role",
|
||||
"sortOrder",
|
||||
"totalEmails",
|
||||
"unreadEmails",
|
||||
"totalThreads",
|
||||
"unreadThreads",
|
||||
"myRights",
|
||||
"isSubscribed",
|
||||
"shareWith",
|
||||
];
|
||||
|
||||
export const LIST_PROPS = [
|
||||
"id",
|
||||
"blobId",
|
||||
@@ -210,7 +236,7 @@ export const useMail = create<MailState>((set, get) => ({
|
||||
async loadMailboxes() {
|
||||
const accountId = get().accountId;
|
||||
if (!accountId) return;
|
||||
const res = await client.call<GetResponse<Mailbox>>("Mailbox/get", { accountId, ids: null });
|
||||
const res = await client.call<GetResponse<Mailbox>>("Mailbox/get", { accountId, ids: null, properties: MAILBOX_PROPS });
|
||||
const mailboxes: Record<Id, Mailbox> = {};
|
||||
for (const m of res.list) mailboxes[m.id] = m;
|
||||
set({ mailboxes, mailboxState: res.state, mailboxesLoaded: true });
|
||||
|
||||
Reference in New Issue
Block a user