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:
@@ -69,10 +69,10 @@ itself stays byte-for-byte alignable with upstream's version of the file.
|
|||||||
|
|
||||||
### `account-alias-count-column` 🟡
|
### `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)
|
- **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` and `x:Account/Group` lists — not a real schema property; `DynamicList` resolves it from the real `aliases` objectList property and renders its entry count.
|
- **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**: neither list's schema exposes alias count as a column, only the full `aliases` list on the detail view.
|
- **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 `x:Account/User` and `x:Account/Group` list schemas include a computed alias-count column natively; this column definition is deleted.
|
- **Ideal fix**: the server's list schemas include a computed alias-count column natively; these column definitions are deleted.
|
||||||
|
|
||||||
### `account-client-sort` 🟡
|
### `account-client-sort` 🟡
|
||||||
|
|
||||||
|
|||||||
@@ -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' }] },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import { useUIStore } from '@/stores/uiStore';
|
|||||||
import { fetchSession, fetchSchema, fetchAccountInfo } from '@/services/jmap/client';
|
import { fetchSession, fetchSchema, fetchAccountInfo } from '@/services/jmap/client';
|
||||||
import { withClientLogFilters } from '@/lib/logFilters';
|
import { withClientLogFilters } from '@/lib/logFilters';
|
||||||
import { withAccountListColumns } from '@/lib/accountColumns';
|
import { withAccountListColumns } from '@/lib/accountColumns';
|
||||||
|
import { withMailingListColumns } from '@/lib/mailingListColumns';
|
||||||
import { setLocale } from '@/i18n';
|
import { setLocale } from '@/i18n';
|
||||||
import { TopBar } from '@/components/layout/TopBar';
|
import { TopBar } from '@/components/layout/TopBar';
|
||||||
import { Sidebar } from '@/components/layout/Sidebar';
|
import { Sidebar } from '@/components/layout/Sidebar';
|
||||||
@@ -150,7 +151,7 @@ export default function AdminPanel() {
|
|||||||
|
|
||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
|
|
||||||
setSchema(withAccountListColumns(withClientLogFilters(schemaData)));
|
setSchema(withMailingListColumns(withAccountListColumns(withClientLogFilters(schemaData))));
|
||||||
|
|
||||||
setAccountInfo(accountData.permissions, accountData.edition, accountData.locale);
|
setAccountInfo(accountData.permissions, accountData.edition, accountData.locale);
|
||||||
setLocale(accountData.locale);
|
setLocale(accountData.locale);
|
||||||
|
|||||||
Reference in New Issue
Block a user