chore(release): v1.28.16 — documents-only shares stay documents-only

A share link created to carry only documents now records an explicit,
frozen document_only flag, and the shared view gates on that flag directly
instead of inferring documents-only from "are all report sections off?".
The inference would have re-opened an existing documents-only link the day
a new report section was added — the link's frozen settings never mention
the new section, so it would default on and begin serving that data. The
flag closes that path; the derived check stays only as the fallback for
links created before the column.

Migration 0237 adds the column and freezes it on for every existing link
whose sections are entirely off (checked at any nesting depth), leaving
full-record shares untouched.
This commit is contained in:
Marc-André Bombeck committed 2026-07-10 02:08:03 +02:00
1 parent fcff168112
commit 6d02711e33
11 files changed
+121 -8

No files matched your search

@@ -294,6 +294,10 @@ describe("POST /api/share-links — create", () => {
// Sections persist as an explicit all-OFF blob (distinct from `{}` = full
// record defaults). The clinician view reads this as "no report".
expect(createArg.data.sectionsJson).toEqual(EMPTY_DOCTOR_REPORT_PREFS);
// v1.28.16 — the frozen documents-only flag is persisted so the view path
// gates on the column, not on inferring "all sections off". This is what a
// future report section can never re-open.
expect(createArg.data.documentOnly).toBe(true);
// The picked document still rides along.
expect(createArg.data.documents).toEqual({
create: [{ documentId: "doc-a" }],
+6
View File
@@ -67,6 +67,7 @@ const shareLinkSummarySelect = {
rangeEnd: true,
resourceTypes: true,
allowFhirApi: true,
documentOnly: true,
passphraseHash: true,
expiresAt: true,
createdAt: true,
@@ -84,6 +85,7 @@ function toSummary(row: {
rangeEnd: Date | null;
resourceTypes: string[];
allowFhirApi: boolean;
documentOnly: boolean;
passphraseHash: string | null;
expiresAt: Date;
createdAt: Date;
@@ -99,6 +101,9 @@ function toSummary(row: {
rangeEnd: row.rangeEnd ? row.rangeEnd.toISOString() : null,
resourceTypes: row.resourceTypes,
allowFhirApi: row.allowFhirApi,
// v1.28.16 — the frozen documents-only flag (owner-facing; the serve path
// gates on the column, not on "are all sections off?").
documentOnly: row.documentOnly,
// v1.18.7 — surface only WHETHER a passphrase guards the link, never the
// hash itself. Legacy (null-hash) links read `false` and stay ungated.
protected: row.passphraseHash !== null,
@@ -193,6 +198,7 @@ export const POST = apiHandler(async (request: NextRequest) => {
sectionsJson: sectionsJson as Prisma.InputJsonValue,
resourceTypes,
allowFhirApi,
documentOnly,
expiresAt: new Date(input.expiresAt),
documents:
documentIds.length > 0