diff --git a/AGENTS.md b/AGENTS.md
index 37613de..64dfa16 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -52,7 +52,8 @@ What the app is and how to run it: [`README.md`](README.md). UI rules: [`docs/de
PDFs, `regulations:rectify` rettifiche and Deleghe. Per-draft access (viewer, commenter, editor) and deleghe are
backend data: `regulations.me.get` admits an account without `admin:access` to Regolamenti › Bozze only, draft-scoped
server functions use `regulationsAssigneeMiddleware`, and pages act on the document's `editable` and the draft's `can`
- from the backend. Every PDF opens in `PdfDialog`. The editor connects to the collab service with a single-use ticket
+ from the backend. A secret draft (`secret`) is seen only by its creator and the members they add, permissions
+ notwithstanding, and its procedure stays closed until the creator makes it visible (`drafts.reveal`, for good). Every PDF opens in `PdfDialog`. The editor connects to the collab service with a single-use ticket
from a server function, never a token. UI copy is Italian. Details: `docs/regulations/README.md`.
- **Shared UI**: `src/components/shell`, `src/components/primitives`, `src/components/ui`.
diff --git a/docs/regulations/README.md b/docs/regulations/README.md
index d1d2e1e..2d607d3 100644
--- a/docs/regulations/README.md
+++ b/docs/regulations/README.md
@@ -61,6 +61,13 @@ Every section but Bozze also needs `admin:access`, like the rest of the dashboar
editor, and a delega lets anyone rectify. `loadAccess` admits a user without `admin:access` or `people:self` when
`regulations.me.get` reports an assignment or a delega; `/dashboard` then shows them only Regolamenti › Bozze
(`peopleRoles.regulations`, the `regulations` section role in `nav.ts`), and the logo leads there.
+- **Secret drafts.** "Nuova bozza" asks who sees it: "Visibile" (`regulations:read` and the members) or "Segreta"
+ (`secret: true`): only its creator and the members they add, whatever their IdP permissions, with the role given in
+ the members dialog (a Direttivo member too); not even `regulations:write` or `:manage` see it, in lists or counts.
+ Only the creator manages members, deletes it and makes it visible ("Rendi visibile" on the procedure page,
+ `drafts.reveal`, for good). Until then its procedure is closed: the steps show disabled with the backend's reason, and
+ the page says why once. A draft from a secret draft is secret too. Lists and headers mark it "Segreta"
+ (`DraftSecretMark`).
- **Middleware** (`src/server/auth.middleware.ts`): `regulationsReadMiddleware`, `regulationsWriteMiddleware`,
`regulationsManageMiddleware` and `regulationsRectifyMiddleware` check the permission; draft-scoped calls (collab
ticket, comments, snapshots, rename and delete, rettifiche) use `regulationsAssigneeMiddleware`, which admits any
@@ -71,7 +78,7 @@ Every section but Bozze also needs `admin:access`, like the rest of the dashboar
`src/features/regulations/regulations.contract.ts` is a verbatim copy of the backend's `src/regulations/contract.ts`
(PoliNetworkOrg/backend#110); `regulations.api.server.ts` maps one method to each procedure and parses every response.
-Procedures: `me.get`, `documents.list|get|sync|create|upload`, `templates.list`, `versions.list|pdf|upload`, `drafts.list|get|files|create|rename|delete|transition`,
+Procedures: `me.get`, `documents.list|get|sync|create|upload`, `templates.list`, `versions.list|pdf|upload`, `drafts.list|get|files|create|rename|delete|reveal|transition`,
`assignments.list|set|remove`, `users.search`, `collabTicket`, `compile.status|pdf`, `snapshots.list|get|create|restore`,
`comments.list|create|reply|resolve|reopen|delete`, `merge.preview|execute`, `diff.get|regenerate|pdf`,
`emanation.get|start|retry`, `deleghe.list|create|revoke`. Files (PDFs) come back as `{ fileName, contentType, base64 }`
@@ -110,6 +117,7 @@ one. Logic: `editor/draft-files.ts`.
`regulations.fixtures.server.ts`: the RRI with three drafts, two versions, the older one an untagged import labelled as
the backend labels it, `import d08cb57`, a delega, a comment; the Guida della Matricola, a documento generale with a
published draft and an open one; a private document from the generale template; an uploaded PDF with two versions;
+two secret RRI drafts, the agent's (shared with one Socio) and the Presidente's, which the agent never sees;
Statuto and Regolamento Elettorale, sola consultazione; a repository document "In creazione" and one whose pull request
was closed). A repository document created in agent mode turns active 20 s later, as if its pull request merged; a
private documento publishes at once. Version PDFs are compiled from their sources (stand-ins for the `polinetwork-regolamento` and `polinetwork` classes),
diff --git a/src/features/regulations/document-page.tsx b/src/features/regulations/document-page.tsx
index 42304b6..a8e390e 100644
--- a/src/features/regulations/document-page.tsx
+++ b/src/features/regulations/document-page.tsx
@@ -38,7 +38,7 @@ import { NewDraftDialog, type NewDraftTarget } from "./new-draft-dialog"
import { downloadPdf, PdfDialog, usePdfDialog } from "./pdf-dialog"
import { baseLabel, formatDay, versionOrigin } from "./regulations-format"
import { failureMessage } from "./regulations-hooks"
-import { DraftKindMark, DraftStateBadge } from "./regulations-ui"
+import { DraftKindMark, DraftSecretMark, DraftStateBadge } from "./regulations-ui"
import type { DocumentInfo, DraftSummary, VersionSummary } from "./regulations.contract"
import { getVersionPdf } from "./regulations.functions"
import { UploadVersionDialog } from "./upload-version-dialog"
@@ -165,6 +165,7 @@ export function DocumentPage({
{draft.title}
+
),
},
diff --git a/src/features/regulations/drafts-page.tsx b/src/features/regulations/drafts-page.tsx
index c42b798..662a88e 100644
--- a/src/features/regulations/drafts-page.tsx
+++ b/src/features/regulations/drafts-page.tsx
@@ -17,7 +17,7 @@ import { Button } from "@/components/ui/button"
import { NewDraftDialog, type NewDraftTarget } from "./new-draft-dialog"
import { baseLabel, formatDay, isFinalState, ROLE_LABELS } from "./regulations-format"
-import { DraftKindMark, DraftStateBadge } from "./regulations-ui"
+import { DraftKindMark, DraftSecretMark, DraftStateBadge } from "./regulations-ui"
import type { DocumentInfo, DraftSummary, Me } from "./regulations.contract"
type Filter = "open" | "closed"
@@ -57,6 +57,7 @@ export function DraftsPage({ drafts, me, documents }: { drafts: DraftSummary[];
{draft.title}
+ di {draft.createdBy.name}
diff --git a/src/features/regulations/editor/editor-page.tsx b/src/features/regulations/editor/editor-page.tsx
index 9d1796c..2779959 100644
--- a/src/features/regulations/editor/editor-page.tsx
+++ b/src/features/regulations/editor/editor-page.tsx
@@ -37,7 +37,7 @@ import { cn } from "@/lib/utils"
import { parseDocument, type StructureNode } from "../latex-structure"
import { MembersDialog } from "../members-dialog"
import { downloadPdf, PdfDialog, usePdfDialog } from "../pdf-dialog"
-import { DraftKindMark, DraftStateBadge } from "../regulations-ui"
+import { DraftKindMark, DraftSecretMark, DraftStateBadge } from "../regulations-ui"
import type {
Assignment,
CommentThread,
@@ -431,6 +431,7 @@ export function EditorPage({ draft, members }: { draft: Draft; members: Assignme
{draft.title}
+
{collab.peers.length > 0 ? (
void
- draft: { id: string; title: string }
+ draft: { id: string; title: string; secret: boolean; createdBy: { id: string } }
members: Assignment[]
}) {
const search = useServerFn(searchRegulationUsers)
@@ -161,10 +162,17 @@ export function MembersDialog({
size="lg"
title="Membri della bozza"
description={
- <>
- Chi aggiungi vede «{draft.title}» in Regolamenti › Bozze, anche senza altro accesso alla dashboard. Il
- Direttivo legge e modifica sempre ogni bozza.
- >
+ draft.secret ? (
+ <>
+ «{draft.title}» è segreta: la vedono solo i membri, in Regolamenti › Bozze, con il ruolo che scegli qui,
+ anche se sono nel Direttivo.
+ >
+ ) : (
+ <>
+ Chi aggiungi vede «{draft.title}» in Regolamenti › Bozze, anche senza altro accesso alla dashboard. Il
+ Direttivo legge e modifica sempre ogni bozza.
+ >
+ )
}
noun="membri"
dirty={false}
@@ -247,31 +255,35 @@ export function MembersDialog({
{members.map((member) => (
+ {draft.secret ? (
+
+ {draft.can.reveal
+ ? "Bozza segreta: la vedete solo tu e i membri che aggiungi, non chi ha accesso ai Regolamenti. La procedura parte quando la rendi visibile."
+ : `Bozza segreta: la vedono solo ${draft.createdBy.name} e i membri che aggiunge, non chi ha accesso ai Regolamenti. La procedura parte quando la rende visibile.`}
+
+ ) : null}
{draft.parses === false && draft.state === "bozza" ? (
{documento
@@ -388,9 +410,15 @@ export function ProcedurePage({
- {draft.can.emanateBlockedBy ? (
+ {/* A secret draft's reason is the alert above; the buttons keep it as their hint. */}
+ {draft.can.emanateBlockedBy && !draft.secret ? (