diff --git a/CHANGELOG.md b/CHANGELOG.md index 271c7b367..40a9f1fa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. ## Unreleased +### Fixed + +- Fix document classification not being passed when creating documents +- Fix document classification changes not syncing to draft versions + ## [0.76.0] - 2025-10-22 ### Added diff --git a/pkg/probo/document_service.go b/pkg/probo/document_service.go index 698e2a66b..25fe021c9 100644 --- a/pkg/probo/document_service.go +++ b/pkg/probo/document_service.go @@ -1168,6 +1168,20 @@ func (s *DocumentService) Update( return fmt.Errorf("cannot update document: %w", err) } + // Update the draft version if it exists to keep it in sync with the document + draftVersion := &coredata.DocumentVersion{} + err := draftVersion.LoadLatestVersion(ctx, tx, s.svc.scope, req.DocumentID) + if err == nil && draftVersion.Status == coredata.DocumentStatusDraft { + draftVersion.Title = document.Title + draftVersion.OwnerID = document.OwnerID + draftVersion.Classification = document.Classification + draftVersion.UpdatedAt = now + + if err := draftVersion.Update(ctx, tx, s.svc.scope); err != nil { + return fmt.Errorf("cannot update draft version: %w", err) + } + } + return nil }, ) diff --git a/pkg/server/api/console/v1/v1_resolver.go b/pkg/server/api/console/v1/v1_resolver.go index 38072404a..6aa32159b 100644 --- a/pkg/server/api/console/v1/v1_resolver.go +++ b/pkg/server/api/console/v1/v1_resolver.go @@ -2547,6 +2547,7 @@ func (r *mutationResolver) CreateDocument(ctx context.Context, input types.Creat Title: input.Title, OwnerID: input.OwnerID, Content: input.Content, + Classification: input.Classification, TrustCenterVisibility: input.TrustCenterVisibility, }, )