Allow editing metadata of generated document versions
Title, document type, and classification on generated documents could not be changed: any version-tracked field on a GENERATED write-mode document was rejected with ErrDocumentVersionGenerated. The error now fires only when content is being changed, so manual metadata edits flow through the same draft-on-edit path as authored documents and produce a draft version that the user can review and publish. The CLI document update --document-type enum gains STATEMENT_OF_APPLICABILITY (which generated SoA documents already use), and the GraphQL resolver maps the content-edit rejection to a Conflict instead of falling through to a generic Internal error. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -225,7 +225,7 @@ export function DocumentLayout(props: { queryRef: PreloadedQuery<DocumentLayoutQ
|
||||
fKey={currentVersion}
|
||||
documentId={document.id}
|
||||
documentStatus={document.status}
|
||||
isEditable={isEditable && !isGenerated}
|
||||
isEditable={isEditable}
|
||||
onDocumentUpdated={handleDocumentUpdated}
|
||||
/>
|
||||
)}
|
||||
@@ -242,7 +242,6 @@ export function DocumentLayout(props: { queryRef: PreloadedQuery<DocumentLayoutQ
|
||||
documentFragmentRef={document}
|
||||
versionFragmentRef={currentVersion}
|
||||
isEditable={isEditable}
|
||||
isGenerated={isGenerated}
|
||||
isLatestVersion={isLatestVersion}
|
||||
onDocumentUpdated={handleDocumentUpdated}
|
||||
/>
|
||||
|
||||
@@ -124,7 +124,6 @@ export function DocumentDetailsCard(props: {
|
||||
documentFragmentRef: DocumentDetailsCard_documentFragment$key;
|
||||
versionFragmentRef: DocumentDetailsCard_versionFragment$key;
|
||||
isEditable: boolean;
|
||||
isGenerated?: boolean;
|
||||
isLatestVersion?: boolean;
|
||||
onDocumentUpdated: () => void;
|
||||
}) {
|
||||
@@ -132,7 +131,6 @@ export function DocumentDetailsCard(props: {
|
||||
documentFragmentRef,
|
||||
versionFragmentRef,
|
||||
isEditable,
|
||||
isGenerated = false,
|
||||
isLatestVersion = true,
|
||||
onDocumentUpdated,
|
||||
} = props;
|
||||
@@ -149,7 +147,7 @@ export function DocumentDetailsCard(props: {
|
||||
const version = useFragment<DocumentDetailsCard_versionFragment$key>(versionFragment, versionFragmentRef);
|
||||
|
||||
const canEdit = document.canUpdate && isEditable;
|
||||
const canEditVersionFields = canEdit && !isGenerated;
|
||||
const canEditVersionFields = canEdit;
|
||||
const canEditApprovers = document.canUpdate && isLatestVersion;
|
||||
|
||||
const { control, handleSubmit, reset } = useFormWithSchema(
|
||||
|
||||
Reference in New Issue
Block a user