Show an assigned shared mailbox as shared, not as a locked account
ci / version (pull_request) Skipped
ci / github (pull_request) Skipped
ci / node (pull_request) Successful in 1m29s
ci / publish (pull_request) Skipped
ci / announce (pull_request) Skipped
ci / docker-build (pull_request) Successful in 36s
github/ci (branch) GitHub Actions
ci / version (pull_request) Skipped
ci / github (pull_request) Skipped
ci / node (pull_request) Successful in 1m29s
ci / publish (pull_request) Skipped
ci / announce (pull_request) Skipped
ci / docker-build (pull_request) Successful in 36s
github/ci (branch) GitHub Actions
The server now marks a shared mailbox (support@, legal@) as a delegation of kind "sharedMailbox" (multi-account spec, MA-S). Without this, the webmail would show one exactly as it shows a locked account: a red bar, a padlock in the tab and on the brand, and its calendars and files in place of the reader's own. Now such a mailbox is listed with the other shared mailboxes under "Mail to show", opens with the shared bar, which also gives the person's access level and whether they can send as it, and changes mail only. Its access level still applies exactly as a lock's does: read changes nothing, organize never deletes, no sending without send-as. Found without asking Mailbox/get, since the server's mark says it is mail. A server that sends no kind is treated as before: every delegation is a lock. No new strings. typecheck and vitest (174 files, 1534 tests) pass.
This commit is contained in:
1 parent
7f12a7d8ee
commit
c66a8aadd7
7 files changed
+51
-14
No files matched your search
@@ -13,6 +13,12 @@ export type DelegationAccess = "read" | "organize" | "full";
|
||||
|
||||
export interface Delegation {
|
||||
locked: boolean;
|
||||
/**
|
||||
* A locked account, or a shared mailbox such as support@ (MA-S). Both are
|
||||
* reached as a delegate at an access level; only how they are shown
|
||||
* differs. Absent from older servers, where it is always a lock.
|
||||
*/
|
||||
kind: "lock" | "sharedMailbox";
|
||||
access: DelegationAccess;
|
||||
sendAs: boolean;
|
||||
/** UTC date the delegation ends, if it does. */
|
||||
@@ -38,19 +44,20 @@ export function delegationOf(session: SessionLike | null, accountId: Id | null):
|
||||
const access: DelegationAccess = raw.access === "organize" || raw.access === "full" ? raw.access : "read";
|
||||
return {
|
||||
locked: true,
|
||||
kind: raw.kind === "sharedMailbox" ? "sharedMailbox" : "lock",
|
||||
access,
|
||||
sendAs: raw.sendAs === true && access !== "read",
|
||||
until: typeof raw.until === "string" ? raw.until : null,
|
||||
};
|
||||
}
|
||||
|
||||
/** Every locked account handed to the reader, by name. */
|
||||
/** Every locked account handed to the reader, by name. Shared mailboxes are listed by lib/sharedMail. */
|
||||
export function delegatedAccounts(session: SessionLike | null): DelegatedAccount[] {
|
||||
if (!session) return [];
|
||||
return Object.entries(session.accounts)
|
||||
.map(([id, account]) => {
|
||||
const delegation = delegationOf(session, id);
|
||||
return delegation ? { id, name: account.name, delegation } : null;
|
||||
return delegation?.kind === "lock" ? { id, name: account.name, delegation } : null;
|
||||
})
|
||||
.filter((a): a is DelegatedAccount => a !== null)
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
Reference in new issue
Block a user