feat(mailing-lists): add Aliases count column

Same account-alias-count-column deviation already used on Accounts and
Groups, extended to x:MailingList: adds a synthetic aliasCount column
and lets DynamicList's existing generic column-name-driven handling
resolve/render it — no changes needed there, the mechanism was already
list-agnostic.

Verified in the running dev server: the column renders 0 with no
aliases set on either seeded mailing list.
This commit is contained in:
Steven RYDELL
2026-08-01 22:19:35 +02:00
parent d9b073ad6c
commit 9cd21a2d34
3 changed files with 34 additions and 5 deletions
+4 -4
View File
@@ -69,10 +69,10 @@ itself stays byte-for-byte alignable with upstream's version of the file.
### `account-alias-count-column` 🟡
- **Where**: [`src/lib/accountColumns.ts`](src/lib/accountColumns.ts), rendering in [`src/components/lists/DynamicList.tsx`](src/components/lists/DynamicList.tsx)
- **What**: adds a synthetic `aliasCount` column to the `x:Account/User` and `x:Account/Group` lists — not a real schema property; `DynamicList` resolves it from the real `aliases` objectList property and renders its entry count.
- **Why**: neither list's schema exposes alias count as a column, only the full `aliases` list on the detail view.
- **Ideal fix**: the server's `x:Account/User` and `x:Account/Group` list schemas include a computed alias-count column natively; this column definition is deleted.
- **Where**: [`src/lib/accountColumns.ts`](src/lib/accountColumns.ts), [`src/lib/mailingListColumns.ts`](src/lib/mailingListColumns.ts), rendering in [`src/components/lists/DynamicList.tsx`](src/components/lists/DynamicList.tsx)
- **What**: adds a synthetic `aliasCount` column to the `x:Account/User`, `x:Account/Group`, and `x:MailingList` lists — not a real schema property; `DynamicList` resolves it from the real `aliases` objectList property and renders its entry count.
- **Why**: none of these lists' schemas expose alias count as a column, only the full `aliases` list on the detail view.
- **Ideal fix**: the server's list schemas include a computed alias-count column natively; these column definitions are deleted.
### `account-client-sort` 🟡
+28
View File
@@ -0,0 +1,28 @@
/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
import type { Schema } from '@/types/schema';
/**
* SCHEMA-DEVIATION: account-alias-count-column (see SCHEMA_DEVIATIONS.md)
*
* The Mailing Lists list doesn't expose alias count as a column, only the
* full `aliases` objectList on the detail view. Adds the same synthetic
* `aliasCount` column already used on Accounts/Groups — DynamicList's
* generic count-column handling picks it up with no further wiring.
*/
export function withMailingListColumns(schema: Schema): Schema {
const list = schema.lists['x:MailingList'];
if (!list) return schema;
return {
...schema,
lists: {
...schema.lists,
'x:MailingList': { ...list, columns: [...list.columns, { name: 'aliasCount', label: 'Aliases' }] },
},
};
}
+2 -1
View File
@@ -14,6 +14,7 @@ import { useUIStore } from '@/stores/uiStore';
import { fetchSession, fetchSchema, fetchAccountInfo } from '@/services/jmap/client';
import { withClientLogFilters } from '@/lib/logFilters';
import { withAccountListColumns } from '@/lib/accountColumns';
import { withMailingListColumns } from '@/lib/mailingListColumns';
import { setLocale } from '@/i18n';
import { TopBar } from '@/components/layout/TopBar';
import { Sidebar } from '@/components/layout/Sidebar';
@@ -150,7 +151,7 @@ export default function AdminPanel() {
if (cancelled) return;
setSchema(withAccountListColumns(withClientLogFilters(schemaData)));
setSchema(withMailingListColumns(withAccountListColumns(withClientLogFilters(schemaData))));
setAccountInfo(accountData.permissions, accountData.edition, accountData.locale);
setLocale(accountData.locale);