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 <sacha@probo.com>
This commit is contained in:
@@ -1337,6 +1337,10 @@ func (r *mutationResolver) RequestSignature(ctx context.Context, input types.Req
|
||||
return nil, gqlutils.Conflict(ctx, errNotPublished)
|
||||
}
|
||||
|
||||
if errNotCurrent, ok := errors.AsType[*probo.ErrDocumentVersionNotCurrent](err); ok {
|
||||
return nil, gqlutils.Conflict(ctx, errNotCurrent)
|
||||
}
|
||||
|
||||
if errContractEnded, ok := errors.AsType[*probo.ErrProfileContractEnded](err); ok {
|
||||
return nil, gqlutils.Conflict(ctx, errContractEnded)
|
||||
}
|
||||
|
||||
@@ -2456,6 +2456,10 @@ func (r *Resolver) RequestDocumentVersionSignatureTool(ctx context.Context, req
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
if _, ok := errors.AsType[*probo.ErrDocumentVersionNotCurrent](err); ok {
|
||||
return nil, types.RequestDocumentVersionSignatureOutput{}, fmt.Errorf("cannot request signature: %w", err)
|
||||
}
|
||||
|
||||
panic(fmt.Errorf("cannot request signature: %w", err))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user