Open locked accounts handed to you, beside your own mail

When the server hands a locked account to the reader (urn:inbuxa:jmap
delegation), the account popover offers it. Only mail follows the switch;
the reader's own settings, push and notifications stay theirs. A red bar,
a red wordmark with a padlock and the tab title say which account is in
view. Read delegates can't change anything, organize delegates can't
delete, and writing needs send-as. A delegation taken away drops back to
the reader's own mail.

14 new strings in all nine catalogs, unreviewed (inbuxa AL-7, AL-8).
This commit is contained in:
jcoffey-dev committed 2026-09-27 14:32:10 -07:00
1 parent ffe1a898f5
commit 8674b70f62
22 files changed
+679 -25

No files matched your search

+28
View File
@@ -16,6 +16,7 @@ import { LabelPicker } from "./LabelPicker";
import type { Id } from "@/jmap/types";
import { confirmDialog } from "@/ui/dialog";
import { toast } from "@/ui/toast";
import { viewingDelegation } from "@/store/session";
import { isUnknownMailbox } from "@/lib/mailbox/mailboxRoute";
import { scheduledMailboxIdFrom, useScheduled } from "@/store/scheduled";
import { plural, t as translate, tNode } from "@/lib/i18n";
@@ -284,15 +285,36 @@ export function MailView({ mailboxId, threadId, search }: { mailboxId?: string;
[threadId, currentRowIndex, settings.autoAdvance, ids, rowThreadId, openThread, setFocusId],
);
/*
* inbuxa AL-6: in a locked account handed to the reader, what their level
* doesn't allow says so instead of trying. Read changes nothing; organize
* moves and flags but never deletes, so Trash and Junk are out of reach.
*/
const refused = (destroys: boolean): boolean => {
const delegation = viewingDelegation();
if (!delegation) return false;
if (delegation.access === "read") {
toast.show(translate("This account was handed to you to read. Nothing in it can be changed."));
return true;
}
if (destroys && delegation.access === "organize") {
toast.show(translate("You can file and move mail in this account, but not delete it."));
return true;
}
return false;
};
const actions = useMemo(
() => ({
archive: async (rows?: Id[]) => {
if (refused(false)) return;
const t = await targetIds(rows);
if (!t.length) return;
await useMail.getState().archive(t);
afterAction(true);
},
trash: async (rows?: Id[]) => {
if (refused(true)) return;
const t = await targetIds(rows);
if (!t.length) return;
const mail = useMail.getState();
@@ -315,6 +337,7 @@ export function MailView({ mailboxId, threadId, search }: { mailboxId?: string;
afterAction(true);
},
spam: async (rows?: Id[]) => {
if (refused(true)) return;
const t = await targetIds(rows);
if (!t.length) return;
const mail = useMail.getState();
@@ -324,23 +347,28 @@ export function MailView({ mailboxId, threadId, search }: { mailboxId?: string;
afterAction(true);
},
read: async (read: boolean, rows?: Id[]) => {
if (refused(false)) return;
const t = await targetIds(rows);
if (t.length) await useMail.getState().markRead(t, read);
useMail.getState().clearSelection();
},
star: async (on: boolean, rows?: Id[]) => {
if (refused(false)) return;
const t = await targetIds(rows);
if (t.length) await useMail.getState().star(t, on);
},
move: async (rows?: Id[]) => {
if (refused(false)) return;
const t = await targetIds(rows);
if (t.length) setMovePicker({ ids: t });
},
label: async (rows: Id[] | undefined, anchor: { x: number; y: number }) => {
if (refused(false)) return;
const t = await targetIds(rows);
if (t.length) setLabelPicker({ ids: t, anchor });
},
moveTo: async (ids: Id[], mailboxId: Id) => {
if (refused(false)) return;
await useMail.getState().move(ids, mailboxId);
afterAction(true);
},