U1 mail-foundation (frontend en documentatie): Mail-kaart bij Instellingen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 18:22:27 +01:00
co-authored by Claude Sonnet 5.5
parent 745f0b2203
commit 2a0561a58e
15 changed files with 442 additions and 5 deletions
@@ -5,7 +5,7 @@
- **Feature Slug**: identity-email-notifications
- **Project Type**: Brownfield
- **Start Date**: 2026-11-08
- **Current Stage**: INCEPTION - design presented for approval (Workflow Planning, Application Design, Units); no code before approval
- **Current Stage**: CONSTRUCTION - U1 mail-foundation code generated and tested (local commits, not pushed); requirements and design approved by Bryan (relayed), D1 and D2 decided
- **Branch**: feature/identity-email-notifications (branched from feature/andreaslop-site-hosting at e9feb37; own branch, not merged anywhere)
- **Request Type**: Feature (Bryan chose real e-mail over a workaround button; relayed by session "CMS & API")
@@ -42,6 +42,11 @@
- [x] Workspace Detection - Complete
- [x] Requirements Analysis - P1-P5 decided by Bryan (relayed); requirements.md updated
- [~] User Stories - skipped (see execution plan)
- [x] Workflow Planning - written, approval pending
- [x] Application Design - written, approval pending (choices D1, D2)
- [x] Workflow Planning - approved (relayed)
- [x] Application Design - approved (relayed); D1 picker in invite dialog, D2 stamp in access token (U3)
- [x] Units Generation - U1 mail-foundation, U2 identity-mail-flows, U3 password-reset
### CONSTRUCTION
- [x] U1 mail-foundation - Infrastructure Design (construction/mail-foundation/infrastructure-design/infrastructure-design.md), Code Generation done, build and tests green (see code-summary.md); hand-back pending
- [ ] U2 identity-mail-flows
- [ ] U3 password-reset (includes D2: security stamp in the access token)
@@ -57,3 +57,15 @@
**Context**: Inception documents complete; approval of requirements and design pending, no code.
---
## Construction U1 - approval and code generation
**Timestamp**: 2026-11-08T20:30:00Z
**User Input**: "(Relayed by 'CMS & API', Bryan's decisions) Requirements + ontwerp identity-email-notifications: AKKOORD, begin met Code Generation van U1. D1: beheerder kiest nl/en in het uitnodigingsvenster (default sitetaal), bewaard op de uitnodiging, bij afronden overgenomen. D2: direct beeindigen: security stamp in access-token en vergelijken in de actief-controle (ook voor gewone wachtwoordwijziging); tokens van voor de deploy eenmalig geweigerd, refresh geeft stil een nieuw token. Test dit expliciet en meld het als gedragswijziging voor SLP Software. SMTP voor Infrastructure Design: Email__Smtp__Host=mail.slpsoftware.nl, Port=587, EnableSsl=true (STARTTLS). FromAddress/FromName ... no-reply@slpsoftware.nl. Let op SPF-aligned ... blijft productie-checklistpunt. ... Werk U1 op feature/identity-email-notifications, commit lokaal, geen push voordat U1 getest is; meld je na U1 met testresultaten en wat je op ASF test wilt uitrollen."
**AI Response**: "Built U1 (Core email building blocks, SiteSettings store + migration, SiteSettings API, Mail card, capabilities flags, config sections, README). Tests: Core 452, Identity 96, Availability 82, Master 57, Offerings 57, ASF config 6, frontend 333; MariaDB-backed migration up/down/up and DateTimeOffset round trip verified against a real MariaDB container; vulnerability scan clean. D2 (stamp in access tokens) belongs to U3 and is recorded in the plan."
**Context**: Construction U1, per-unit build and test done; completion message to follow via the peer session.
---
@@ -0,0 +1,28 @@
# Code summary - U1 mail-foundation
## What was built
**Core (`SlpModularCms.Core/Email`, `/SiteSettings`)**
- `IEmailSender` (`SendAsync(OutgoingMail)` returning `MailSendResult`; SimpleDeckApp-shaped extension `SendAsync(to, subject, html)`), `SmtpEmailSender` (MailKit 4.18.2: StartTls when `EnableSsl`, authenticate only with a username, connect/send bounded by `TimeoutSeconds`, every exception mapped to `timeout|auth_failed|rejected|unknown`, exception type only in the log), `NullEmailSender` (`disabled`).
- Headers are validated before connecting (`EmailAddressRules`: strict ASCII address allowlist, display name without control characters, colour `#rrggbb`); a bad value is refused with `rejected` and nothing is sent.
- `EmailOptions` (section `Email`) and `AppMailOptions` (section `App`: `PublicBaseUrl`, `DefaultLanguage`), `EmailOptionsValidator` (start-up validation, only when `Email:Smtp:Host` is set; messages never contain credentials).
- `MailTemplateRenderer` (six kinds, nl/en, one shared HTML layout with logo or site name, brand colour, button plus raw link, plain-text part; all values HTML-encoded; subject without control characters; unknown language falls back to Dutch), `LanguageResolver` (user, site default, Dutch).
- `SiteSettingsEntity` + `ISiteSettingsService`/`SiteSettingsService` (sender address only from default + `Email:AllowedFromAddresses`, name 1..80 without control characters, blank = reset to defaults, a stored address that is no longer allowed falls back to the default on use). Table `SiteSettings` (migration `AddSiteSettings`, additive, with `Down`).
- `AddCmsEmail` registration (null sender when mail is off), `SystemController` capabilities now include `EmailEnabled` and `DefaultLanguage`.
**Identity module**: `SiteSettingsController` (`GET SiteSettings/mail` AdminOnly, `PUT SiteSettings/mail` OwnerOnly; 400 with code for invalid, 409 when mail is off).
**Config**: `Email` and `App` sections (mail OFF, no credentials) in the ASF and SlpSoftware `appsettings.json`.
**Frontend**: `MailSettingsCard` on the Settings page (only when `emailEnabled`; Owner edits, Administrator read-only; select limited to allowed addresses; restore defaults), `useMailSettings`, capabilities hook reads `emailEnabled`/`defaultLanguage`, nl/en strings.
## Decisions kept from the design
No mail configuration means no behaviour change anywhere. Sending never throws into callers. Sender address is never free text. Logo and colour come from per-site config (`Email:LogoUrl`, `Email:BrandColor`).
## Tests
- Core.Tests 452: option validation (every rule, no credentials in messages), address/name rules, renderer (nl/en, fallback, encoding, role names, no link without button, invalid colour), `SmtpEmailSender` against an in-process SMTP stub (success, sender override, SimpleDeckApp-shaped call, header injection refused without connecting, timeout, nothing listening, not configured, disabled), site settings (default, allowed, rejected, reset, narrowed allowlist, mail off), registration (null/SMTP sender, start-up failure), capabilities flag.
- Property-based (PBT-03/07/08/09 partial): rendering never throws/never leaks raw markup/subject stays one line for any generated value; control characters never valid in a display name; only the allowed alphabet in addresses; sender never outside default + allowlist; token survives the link round trip (PBT-02).
- MariaDB-backed (run when `ConnectionStrings__DefaultConnection` is set, as in CI; own scratch databases): all migrations apply on MariaDB, the newest is undone and re-applied; `DateTimeOffset` round trip.
- Identity.Tests 96 (new `SiteSettingsControllerTests`: policies AdminOnly/OwnerOnly, status mapping). Frontend 333 (card: hidden when off, Owner saves, allowed options only, save disabled/empty/too-long name, reset, Administrator read-only; capabilities flags). ESLint and tsc clean. `dotnet list package --vulnerable` clean.
## Not run locally
`Api.Tests` and the ASF `HostPipelineTests` (the developer's `appsettings.local.json` overrides the connection string and points to a database that is not running); CI runs them. The new migration was verified separately on a real MariaDB (above).
@@ -0,0 +1,34 @@
# Infrastructure design - U1 mail-foundation
## Configuration keys (per environment, on the host)
| Key | Where | Example / note |
|---|---|---|
| `Email__Smtp__Host` | `shared/env` | `mail.slpsoftware.nl` (the SMTP host SimpleDeckApp uses in production, per Bryan). Setting it switches mail ON. |
| `Email__Smtp__Port` | `shared/env` | `587` |
| `Email__Smtp__EnableSsl` | `shared/env` | `true` (STARTTLS) |
| `Email__Smtp__Username`, `Email__Smtp__Password` | `shared/env` (mode 600) | secrets, never committed, never in messages or logs |
| `App__PublicBaseUrl` | `shared/env` | `https://test.andreaslop.nl` (https, no path) |
| `App__DefaultLanguage` | optional | `nl` (default) or `en` |
| `Email__FromAddress`, `Email__FromName` | committed default or env | `no-reply@slpsoftware.nl` / site name (SimpleDeckApp's committed default) |
| `Email__AllowedFromAddresses__0..n` | env | extra sender addresses a site may choose in its settings; empty = only `FromAddress` |
| `Email__LogoUrl`, `Email__BrandColor` | committed (ASF) or env | `/admin/brand-logo-on-light.png`, `#5f6a58` |
Start-up validation refuses a broken mail configuration (when a host is set) with a message that never contains the credentials. Without a host nothing changes.
## Local development
smtp4dev (already installed) on `localhost:25`: `Email__Smtp__Host=localhost`, `Email__Smtp__Port=25`, `Email__Smtp__EnableSsl=false`, no username, `App__PublicBaseUrl=http://localhost:5200` (http is accepted for loopback only).
## ASF test host (Operations will do it, needs Bryan's go for the real test mail)
1. Add the keys above to `shared/env` of `andreaslopfotografie-test` (mode 600 stays), restart the unit.
2. `Email__FromAddress` stays `no-reply@slpsoftware.nl` (the SMTP service's own domain). A sender on `@andreaslop.nl` only after the check below.
3. One real test mail to an address of Bryan before approval.
## Sender-domain alignment (production checklist item)
`From:` domain, SPF and DKIM must agree with the SMTP service that actually sends:
- SPF of the `From:` domain must authorise the sending service (today both `slpsoftware.nl` and `andreaslop.nl` publish `v=spf1 a mx include:smtp.spf.ziggo.nl ~all`).
- That service must DKIM-sign for the `From:` domain (a `dkim._domainkey` record exists for both domains; whether the service signs with it is not visible from outside).
- `mail.slpsoftware.nl` will deliver `@andreaslop.nl` mail properly only if it may send/sign for that domain. DMARC is `p=none` today (monitoring only).
- Therefore the sender list is an allowlist: add an `@andreaslop.nl` address to `Email__AllowedFromAddresses` only after this is confirmed.
## No other infrastructure
No new service, port, queue or storage. One additive table (`SiteSettings`) in the existing database.
@@ -0,0 +1,111 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { http, HttpResponse } from 'msw';
import { renderApp, mockAuthenticated } from '@/test/utils';
import { server } from '@/mocks/server';
import { API_BASE, makeAuthResponse, mockUser } from '@/features/auth/mocks/fixtures';
import { _resetSetupStatusCache } from '@/router';
import type { MailSettings } from '@/features/settings/services/types';
beforeEach(() => {
_resetSetupStatusCache();
});
const baseSettings: MailSettings = {
emailEnabled: true,
fromAddress: 'no-reply@slpsoftware.nl',
fromName: 'Andrea Slop Fotografie',
defaultFromAddress: 'no-reply@slpsoftware.nl',
defaultFromName: 'Andrea Slop Fotografie',
allowedFromAddresses: ['no-reply@slpsoftware.nl', 'info@andreaslop.nl'],
isCustomized: false,
};
function mailEnabled(settings: MailSettings = baseSettings, put?: (body: unknown) => void) {
server.use(
http.get('*/System/capabilities', () =>
HttpResponse.json({ modules: ['Availability', 'Identity'], emailEnabled: true, defaultLanguage: 'nl' }),
),
http.get(`${API_BASE}/api/v1/SiteSettings/mail`, () => HttpResponse.json(settings)),
http.put(`${API_BASE}/api/v1/SiteSettings/mail`, async ({ request }) => {
const body = await request.json();
put?.(body);
return HttpResponse.json({ ...settings, isCustomized: true });
}),
);
}
function asAdministrator() {
server.use(
http.post(`${API_BASE}/api/v1/auth/refresh`, () =>
HttpResponse.json(makeAuthResponse({ user: { ...mockUser, role: 'Administrator', name: 'Test Admin' } })),
),
);
}
describe('MailSettingsCard', () => {
it('is not shown when the site cannot send mail', async () => {
mockAuthenticated();
renderApp('/settings');
await screen.findByTestId('settings-title', {}, { timeout: 10000 });
expect(screen.queryByTestId('mail-settings-card')).not.toBeInTheDocument();
});
it('lets the Owner pick an allowed sender and name, and saves them', async () => {
mockAuthenticated();
let saved: unknown;
mailEnabled(baseSettings, (b) => (saved = b));
renderApp('/settings');
const select = await screen.findByTestId('mail-from-address', {}, { timeout: 10000 });
expect(Array.from((select as HTMLSelectElement).options).map((o) => o.value)).toEqual([
'no-reply@slpsoftware.nl',
'info@andreaslop.nl',
]);
await userEvent.selectOptions(select, 'info@andreaslop.nl');
const name = screen.getByTestId('mail-from-name');
await userEvent.clear(name);
await userEvent.type(name, 'Andrea');
await userEvent.click(screen.getByTestId('mail-save-button'));
await vi.waitFor(() => expect(saved).toEqual({ fromAddress: 'info@andreaslop.nl', fromName: 'Andrea' }));
});
it('disables save until something changes, and blocks an empty or too long name', async () => {
mockAuthenticated();
mailEnabled();
renderApp('/settings');
const save = await screen.findByTestId('mail-save-button', {}, { timeout: 10000 });
expect(save).toBeDisabled();
const name = screen.getByTestId('mail-from-name');
await userEvent.clear(name);
expect(save).toBeDisabled();
await userEvent.type(name, 'x'.repeat(81));
expect(screen.getByTestId('mail-from-name-error')).toBeInTheDocument();
expect(save).toBeDisabled();
});
it('offers to restore the defaults only once the sender was customised', async () => {
mockAuthenticated();
mailEnabled({ ...baseSettings, isCustomized: true });
renderApp('/settings');
expect(await screen.findByTestId('mail-reset-button', {}, { timeout: 10000 })).toBeEnabled();
});
it('shows an Administrator the settings read-only', async () => {
asAdministrator();
mailEnabled();
renderApp('/settings');
expect(await screen.findByTestId('mail-from-address', {}, { timeout: 10000 })).toBeDisabled();
expect(screen.getByTestId('mail-from-name')).toBeDisabled();
expect(screen.getByTestId('mail-readonly-note')).toBeInTheDocument();
expect(screen.queryByTestId('mail-save-button')).not.toBeInTheDocument();
});
});
@@ -0,0 +1,120 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { toast } from 'sonner';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useAuth } from '@/features/auth/context/auth-context';
import { ProblemDetailsError } from '@/lib/api-client';
import { useMailSettings, useUpdateMailSettings } from '@/features/settings/services/useMailSettings';
import type { MailSettings } from '@/features/settings/services/types';
const MAX_NAME_LENGTH = 80;
/** Sender of the site's mails. An Administrator sees it, only an Owner changes it. */
export function MailSettingsCard({ emailEnabled }: { emailEnabled: boolean }) {
const { t } = useTranslation();
const { user } = useAuth();
const { data } = useMailSettings(emailEnabled);
// The card exists only where mail is configured: without it nothing here would do anything.
if (!emailEnabled || !data) return null;
// Keyed by the stored values so a saved change re-initialises the form from the server's answer.
return <MailSettingsForm key={`${data.fromAddress}|${data.fromName}`} data={data} canEdit={user?.role === 'Owner'} t={t} />;
}
function MailSettingsForm({ data, canEdit, t }: { data: MailSettings; canEdit: boolean; t: (key: string) => string }) {
const update = useUpdateMailSettings();
const [address, setAddress] = useState(data.fromAddress);
const [name, setName] = useState(data.fromName);
const nameTooLong = name.trim().length > MAX_NAME_LENGTH;
const nameEmpty = name.trim().length === 0;
const unchanged = address === data.fromAddress && name.trim() === data.fromName;
const save = async (payload: { fromAddress: string | null; fromName: string | null }, successKey: string) => {
try {
await update.mutateAsync(payload);
toast.success(t(successKey));
} catch (err) {
if (err instanceof ProblemDetailsError || (err as { status?: number }).status === 400) {
toast.error(t('settings.mail.invalid'));
} else {
toast.error(t('errors.generic'));
}
}
};
return (
<Card data-testid="mail-settings-card">
<CardHeader>
<CardTitle className="text-base">{t('settings.mail.title')}</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<p className="text-sm text-muted-foreground">{t('settings.mail.description')}</p>
<div className="space-y-1">
<Label htmlFor="mail-from-address">{t('settings.mail.fromAddress')}</Label>
<select
id="mail-from-address"
value={address}
onChange={(e) => setAddress(e.target.value)}
disabled={!canEdit}
data-testid="mail-from-address"
className="h-10 w-full rounded-md border border-input bg-background px-3 text-sm disabled:cursor-not-allowed disabled:opacity-50"
>
{data.allowedFromAddresses.map((a) => (
<option key={a} value={a}>
{a}
</option>
))}
</select>
<p className="text-xs text-muted-foreground">{t('settings.mail.fromAddressHelp')}</p>
</div>
<div className="space-y-1">
<Label htmlFor="mail-from-name">{t('settings.mail.fromName')}</Label>
<Input
id="mail-from-name"
value={name}
maxLength={MAX_NAME_LENGTH + 20}
onChange={(e) => setName(e.target.value)}
disabled={!canEdit}
data-testid="mail-from-name"
/>
{nameTooLong && (
<p className="text-sm text-destructive" data-testid="mail-from-name-error">
{t('settings.mail.nameTooLong')}
</p>
)}
</div>
{canEdit ? (
<div className="flex gap-2">
<Button
onClick={() => save({ fromAddress: address, fromName: name.trim() }, 'settings.mail.saveSuccess')}
disabled={update.isPending || unchanged || nameEmpty || nameTooLong}
data-testid="mail-save-button"
>
{update.isPending ? t('settings.availability.saving') : t('settings.mail.save')}
</Button>
<Button
variant="outline"
onClick={() => save({ fromAddress: null, fromName: null }, 'settings.mail.resetSuccess')}
disabled={update.isPending || !data.isCustomized}
data-testid="mail-reset-button"
>
{t('settings.mail.reset')}
</Button>
</div>
) : (
<p className="text-sm text-muted-foreground" data-testid="mail-readonly-note">
{t('settings.mail.readOnly')}
</p>
)}
</CardContent>
</Card>
);
}
@@ -8,6 +8,8 @@ import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Label } from '@/components/ui/label';
import { ProblemDetailsError } from '@/lib/api-client';
import { useSystemCapabilities } from '@/features/system/services/useSystemCapabilities';
import { MailSettingsCard } from '@/features/settings/components/MailSettingsCard';
import type { AvailabilityStatus } from '@/features/availability/services/types';
function PlaceholderCard({ titleKey, comingSoonKey }: { titleKey: string; comingSoonKey: string }) {
@@ -31,6 +33,7 @@ export function SettingsPage() {
const { t } = useTranslation();
const { data: availability, isLoading } = useAvailabilityStatus();
const updateAvailability = useUpdateAvailability();
const { data: capabilities } = useSystemCapabilities();
const [selectedMode, setSelectedMode] = useState<AvailabilityStatus>('Available');
const [reason, setReason] = useState('');
@@ -147,6 +150,8 @@ export function SettingsPage() {
</CardContent>
</Card>
<MailSettingsCard emailEnabled={capabilities?.emailEnabled ?? false} />
<PlaceholderCard
titleKey="settings.modules.title"
comingSoonKey="settings.modules.comingSoon"
@@ -0,0 +1,17 @@
export interface MailSettings {
emailEnabled: boolean;
/** The sender mails go out with right now (stored values if still allowed, else the defaults). */
fromAddress: string;
fromName: string;
defaultFromAddress: string;
defaultFromName: string;
/** The only addresses the sender may be set to (configured per host). */
allowedFromAddresses: string[];
isCustomized: boolean;
}
export interface UpdateMailSettingsPayload {
/** Both empty resets to the configured defaults. */
fromAddress: string | null;
fromName: string | null;
}
@@ -0,0 +1,20 @@
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { api } from '@/lib/api-client';
import type { MailSettings, UpdateMailSettingsPayload } from './types';
export function useMailSettings(enabled: boolean) {
return useQuery<MailSettings, Error>({
queryKey: ['settings', 'mail'],
queryFn: () => api.get<MailSettings>('/api/v1/SiteSettings/mail'),
enabled,
staleTime: 30_000,
});
}
export function useUpdateMailSettings() {
const queryClient = useQueryClient();
return useMutation<MailSettings, Error, UpdateMailSettingsPayload>({
mutationFn: (payload) => api.put<MailSettings>('/api/v1/SiteSettings/mail', payload),
onSuccess: (data) => queryClient.setQueryData(['settings', 'mail'], data),
});
}
@@ -4,6 +4,8 @@ export const systemHandlers = [
http.get('*/System/capabilities', () =>
HttpResponse.json({
modules: ['Availability', 'Identity', 'Master', 'Offerings'],
emailEnabled: false,
defaultLanguage: 'nl',
}),
),
];
@@ -3,4 +3,8 @@
// without that module (local master/slave dev setup).
export interface SystemCapabilities {
modules: string[];
/** Whether this site can send mail (an SMTP host is configured). Mail UI is hidden otherwise. */
emailEnabled: boolean;
/** The site's default language for mails. */
defaultLanguage: 'nl' | 'en';
}
@@ -0,0 +1,42 @@
import { describe, expect, it } from 'vitest';
import { renderHook, waitFor } from '@testing-library/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import type { ReactNode } from 'react';
import { http, HttpResponse } from 'msw';
import { server } from '@/mocks/server';
import { useSystemCapabilities } from './useSystemCapabilities';
function wrapper({ children }: { children: ReactNode }) {
return <QueryClientProvider client={new QueryClient({ defaultOptions: { queries: { retry: false } } })}>{children}</QueryClientProvider>;
}
async function load(body: unknown) {
server.use(http.get('*/System/capabilities', () => HttpResponse.json(body as Record<string, unknown>)));
const { result } = renderHook(() => useSystemCapabilities(), { wrapper });
await waitFor(() => expect(result.current.isSuccess).toBe(true));
return result.current.data!;
}
describe('useSystemCapabilities', () => {
it('reads the mail flags (camelCase)', async () => {
expect(await load({ modules: ['Identity'], emailEnabled: true, defaultLanguage: 'en' })).toEqual({
modules: ['Identity'],
emailEnabled: true,
defaultLanguage: 'en',
});
});
it('reads the mail flags (PascalCase, as the API sends them)', async () => {
const data = await load({ Modules: ['Identity'], EmailEnabled: true, DefaultLanguage: 'EN' });
expect(data.emailEnabled).toBe(true);
expect(data.defaultLanguage).toBe('en');
});
it('treats a host that predates mail as having it off, Dutch as the default', async () => {
expect(await load({ modules: ['Identity'] })).toEqual({ modules: ['Identity'], emailEnabled: false, defaultLanguage: 'nl' });
});
it('falls back to Dutch for an unknown language', async () => {
expect((await load({ modules: [], defaultLanguage: 'fr' })).defaultLanguage).toBe('nl');
});
});
@@ -3,14 +3,23 @@ import { api } from '@/lib/api-client';
import type { SystemCapabilities } from './types';
// Backend may return PascalCase (Modules) if no camelCase policy is set.
type RawSystemCapabilities = { modules?: string[]; Modules?: string[] };
type RawSystemCapabilities = {
modules?: string[]; Modules?: string[];
emailEnabled?: boolean; EmailEnabled?: boolean;
defaultLanguage?: string; DefaultLanguage?: string;
};
export function useSystemCapabilities() {
return useQuery<SystemCapabilities, Error>({
queryKey: ['system', 'capabilities'],
queryFn: async () => {
const raw = await api.get<RawSystemCapabilities>('/api/v1/System/capabilities');
return { modules: raw.modules ?? raw.Modules ?? [] };
const language = (raw.defaultLanguage ?? raw.DefaultLanguage ?? 'nl').toLowerCase();
return {
modules: raw.modules ?? raw.Modules ?? [],
emailEnabled: raw.emailEnabled ?? raw.EmailEnabled ?? false,
defaultLanguage: language === 'en' ? 'en' : 'nl',
};
},
// Which modules a backend has loaded is fixed for the lifetime of that
// backend process — no need to ever refetch within a session.
@@ -177,6 +177,20 @@
},
"settings": {
"title": "System Settings",
"mail": {
"title": "E-mail",
"description": "The address and name this site sends e-mails from (invitations, password reset, notices).",
"fromAddress": "Sender address",
"fromAddressHelp": "Only addresses allowed for this installation (SPF/DKIM). Another address can only be added by whoever manages the server.",
"fromName": "Sender name",
"nameTooLong": "The name can be at most 80 characters.",
"save": "Save",
"reset": "Restore default",
"saveSuccess": "E-mail settings saved",
"resetSuccess": "Default settings restored",
"invalid": "These settings are not valid.",
"readOnly": "Only the owner can change these settings."
},
"availability": {
"title": "System Availability",
"mode": "Availability mode",
@@ -177,6 +177,20 @@
},
"settings": {
"title": "Systeeminstellingen",
"mail": {
"title": "E-mail",
"description": "Van welk adres en onder welke naam deze site e-mails verstuurt (uitnodigingen, wachtwoord opnieuw instellen, meldingen).",
"fromAddress": "Afzenderadres",
"fromAddressHelp": "Alleen adressen die voor deze installatie zijn toegestaan (SPF/DKIM). Een ander adres kan alleen door de beheerder van de server worden toegevoegd.",
"fromName": "Afzendernaam",
"nameTooLong": "De naam mag hooguit 80 tekens bevatten.",
"save": "Opslaan",
"reset": "Standaard herstellen",
"saveSuccess": "E-mailinstellingen opgeslagen",
"resetSuccess": "Standaardinstellingen hersteld",
"invalid": "Deze instellingen zijn niet geldig.",
"readOnly": "Alleen de eigenaar kan deze instellingen wijzigen."
},
"availability": {
"title": "Systeembeschikbaarheid",
"mode": "Beschikbaarheidsmodus",