From a8e8e3e0e7b27c425b632af219e94fbfeab2e4f0 Mon Sep 17 00:00:00 2001 From: Sacha Al Himdani Date: Mon, 22 Jun 2026 18:30:26 +0200 Subject: [PATCH] Allow signature requests only on current published version Requesting a signature only validated that the version was PUBLISHED, so a signature could be requested on a superseded (older) published version. Reject versions that are not the document's current published major/minor, and hide the request button in the console for non-current versions. Signed-off-by: Sacha Al Himdani --- .../_components/DocumentSignaturePlaceholder.tsx | 13 ++++++++++++- pkg/probo/document_service.go | 14 ++++++++++++++ pkg/server/api/console/v1/document_resolvers.go | 4 ++++ pkg/server/api/mcp/v1/schema.resolvers.go | 4 ++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/apps/console/src/pages/organizations/documents/signatures/_components/DocumentSignaturePlaceholder.tsx b/apps/console/src/pages/organizations/documents/signatures/_components/DocumentSignaturePlaceholder.tsx index 228ec165c..32830f7ba 100644 --- a/apps/console/src/pages/organizations/documents/signatures/_components/DocumentSignaturePlaceholder.tsx +++ b/apps/console/src/pages/organizations/documents/signatures/_components/DocumentSignaturePlaceholder.tsx @@ -42,6 +42,12 @@ const versionFragment = graphql` fragment DocumentSignaturePlaceholder_versionFragment on DocumentVersion { id status + major + minor + document { + currentPublishedMajor + currentPublishedMinor + } } `; @@ -81,6 +87,11 @@ export function DocumentSignaturePlaceholder(props: { const person = useFragment(personFragment, personFragmentRef); const version = useFragment(versionFragment, versionFragmentRef); + const isCurrentPublishedVersion + = version.status === "PUBLISHED" + && version.document.currentPublishedMajor === version.major + && version.document.currentPublishedMinor === version.minor; + const [requestSignature, isSendingRequest] = useMutationWithToasts( requestSignatureMutation, { @@ -99,7 +110,7 @@ export function DocumentSignaturePlaceholder(props: { {person.emailAddress} - {version.status === "PUBLISHED" && canRequestSignature && ( + {isCurrentPublishedVersion && canRequestSignature && (