Remove no-changes guard from document version publish
Allow publishing a document version even when the content and title are identical to the current published version. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -59,9 +59,6 @@ type (
|
||||
expectedState coredata.DocumentVersionSignatureState
|
||||
}
|
||||
|
||||
ErrDocumentVersionNoChanges struct {
|
||||
}
|
||||
|
||||
ErrDocumentVersionNotDraft struct {
|
||||
}
|
||||
|
||||
@@ -178,10 +175,6 @@ func (e ErrSignatureNotCancellable) Error() string {
|
||||
)
|
||||
}
|
||||
|
||||
func (e ErrDocumentVersionNoChanges) Error() string {
|
||||
return "no changes detected"
|
||||
}
|
||||
|
||||
func (e ErrDocumentVersionNotDraft) Error() string {
|
||||
return "cannot update a published document version"
|
||||
}
|
||||
@@ -2269,11 +2262,6 @@ func (s *DocumentService) publishMajorVersionInTx(
|
||||
return nil, nil, fmt.Errorf("cannot load published version: %w", err)
|
||||
}
|
||||
|
||||
if publishedVersion.Content == documentVersion.Content &&
|
||||
publishedVersion.Title == documentVersion.Title {
|
||||
return nil, nil, &ErrDocumentVersionNoChanges{}
|
||||
}
|
||||
|
||||
documentVersion.Major = *document.CurrentPublishedMajor + 1
|
||||
} else {
|
||||
documentVersion.Major = 1
|
||||
|
||||
@@ -5560,10 +5560,6 @@ func (r *mutationResolver) PublishMajorDocumentVersion(ctx context.Context, inpu
|
||||
return nil, gqlutils.Invalid(ctx, errNotDraft)
|
||||
}
|
||||
|
||||
if errNoChanges, ok := errors.AsType[*probo.ErrDocumentVersionNoChanges](err); ok {
|
||||
return nil, gqlutils.Invalid(ctx, errNoChanges)
|
||||
}
|
||||
|
||||
r.logger.ErrorCtx(ctx, "cannot publish major document version", log.Error(err))
|
||||
return nil, gqlutils.Internal(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user