Configurable pond start page, created with every new pond #302
Labels
No Label
area:auth
area:docs
area:export
area:ops
area:storage
area:supply-chain
auth
backend
blocked
collab
deployment
docs
effort:L
effort:M
effort:S
frontend
plugins
qa
vs-nfd
vs-nfd:blocker
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: stwaidele/dorfteich#302
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Opening a pond lands on a page nobody chose.
PondHomePage(
apps/web/src/pages/PondHomePage.tsx:34) redirects topages.data[0]—the first page in the pond's sidebar sort order, alphabetical by default.
It is deterministic, but the rule is invisible to the user and the target
moves silently as soon as someone adds a page that sorts ahead of it.
Pond admins should decide which page a pond opens on, and a new pond
should start with a sensible one instead of empty.
Part 1 — configurable start page
New pond setting
startPageIdinpondSettingsSchema(
packages/shared/src/ponds.ts:57), plus the matching key in the flatupdatePondInputSchema(:95— note it is flat, no nesting). Defaultnull, which keeps today's behaviour.
Referencing by page ID, not slug: renaming or moving a page then leaves
the start page intact, since slugs change on rename.
Resolution order in
PondHomePage:settings.startPageIdset and the page appears in the pond's pagelist for this user → redirect there.
Step 1 deliberately checks against the already-loaded page list rather
than fetching the page: the list only contains what this user may see, so
a start page hidden from a particular user by a page-scoped grant falls
back silently instead of producing a 404 on landing. No extra request.
A trashed start page is a stale reference, not an error. The setting is
not cleared eagerly on delete; the pond settings UI shows "no start page
set" when the reference does not resolve, and the admin can pick a new
one. Deleting a page is never blocked because it happens to be the start
page.
UI
Pond settings (
apps/web/src/pages/PondSettingsPage.tsx) gets a pickerlisting the pond's pages, with an explicit "none — first page by sort
order" option. Localised de+en.
Part 2 — start page for new ponds
Both creation paths in
apps/api/src/ponds/ponds.service.tscreate onepage and point
startPageIdat it:createShared(:88)ensurePersonalPond(:118) — a freshly verified user then lands on astart page instead of the empty-pond hint.
Use
PagesService.create()(apps/api/src/pages/pages.service.ts:273)rather than writing the row directly: it owns the invariants — unique
slug, appended sort key, derived content cache, search indexing,
emptyPageState()for the Yjs document, auto-watch. A hand-rolled insertwould produce a page the collab server cannot bind to.
Ordering: create the page after the pond transaction commits. The
owner's
POND_ADMINgrant is written inside that transaction, and thepermission layer caches per pond (
PondPermissionCache) — creating thepage inside the same transaction would query permissions before the grant
is visible. If page creation fails, log it and leave the pond as it is:
a pond without a start page is a valid, degraded state that simply falls
back. It must not roll back the pond itself. Confirm this during
implementation — if it turns out the failure mode is confusing in
practice, the alternative is to fail the whole creation.
Page title
From the creating user's stored locale (
user.locale,apps/api/prisma/schema.prisma:38, already used this way for mails viaasLocaleinapps/api/src/auth/auth.service.ts:156): "Startseite" forde, "Home" foren. Needs a new key in the api-side i18n namespace(pattern:
apiI18n.t,apps/api/src/mail/mail-templates.ts:19).The title is written once at creation and is an ordinary page title
afterwards — renaming it is expected and must not break anything, which
is exactly why the setting stores the ID.
The page is created empty, like any new page.
Existing ponds
Untouched. No migration creates pages and none backfills
startPageId.Existing ponds keep today's behaviour until an admin picks a start page
themselves. Rationale: a migration would either put a page into ponds
whose owners never asked for one — including other people's ponds — or
freeze the current implicit choice as if it had been made deliberately.
Accessibility
alone; it is a normal form control, so no custom widget semantics.
reader announces as blank.
feedback path, not silently.
skip link — the redirect is a
replacenavigation as today.Acceptance criteria
opening the pond honours it.
parent keeps it working.
without an error, and pond settings show that none is set.
page they can see, not on a 404.
creator's locale; the same holds for a personal pond created on
e-mail verification.
collaborates, appears in search and in the sidebar.
pnpm lint,pnpm typecheck,pnpm i18n:check, api suite and thea11y spec pass.