Fix signature count mismatch with signatures tab on documents
The badge on a document version showed signatures filtered by
activeContract: true, while the signatures tab fetched signatures with
no filter and listed people filtered by contractEnded: false and
state: ACTIVE. The two views disagreed both when a signer's contract had
ended and when a signer was deactivated while still under contract.
Add a state: ProfileState field to DocumentVersionSignatureFilter
alongside the existing activeContract filter, so the signature query
can mirror the same predicates as the people query. Pass
{ activeContract: true, state: ACTIVE } from the badge, the document
list item, and the signatures tab fragment. The same filter is now
evaluated on both the count and the list.
Threaded through the console and MCP resolvers, the MCP spec, and the
n8n getAllSignatures operation.
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -279,6 +279,7 @@ func (r *documentVersionResolver) Signatures(ctx context.Context, obj *types.Doc
|
||||
var (
|
||||
signatureStates []coredata.DocumentVersionSignatureState
|
||||
activeContract *bool
|
||||
profileState *coredata.ProfileState
|
||||
)
|
||||
|
||||
if filter != nil {
|
||||
@@ -289,9 +290,13 @@ func (r *documentVersionResolver) Signatures(ctx context.Context, obj *types.Doc
|
||||
if filter.ActiveContract != nil {
|
||||
activeContract = filter.ActiveContract
|
||||
}
|
||||
|
||||
if filter.State != nil {
|
||||
profileState = filter.State
|
||||
}
|
||||
}
|
||||
|
||||
signatureFilter := coredata.NewDocumentVersionSignatureFilter(signatureStates, activeContract)
|
||||
signatureFilter := coredata.NewDocumentVersionSignatureFilter(signatureStates, activeContract, profileState)
|
||||
|
||||
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
|
||||
|
||||
|
||||
@@ -247,6 +247,7 @@ input DocumentVersionSignatureOrder {
|
||||
input DocumentVersionSignatureFilter {
|
||||
states: [DocumentVersionSignatureState!]
|
||||
activeContract: Boolean
|
||||
state: ProfileState
|
||||
}
|
||||
|
||||
input DocumentVersionApprovalQuorumOrder {
|
||||
|
||||
@@ -2188,6 +2188,7 @@ func (r *Resolver) ListDocumentVersionSignaturesTool(ctx context.Context, req *m
|
||||
var (
|
||||
signatureStates []coredata.DocumentVersionSignatureState
|
||||
activeContract *bool
|
||||
profileState *coredata.ProfileState
|
||||
)
|
||||
|
||||
if input.Filter != nil {
|
||||
@@ -2198,9 +2199,13 @@ func (r *Resolver) ListDocumentVersionSignaturesTool(ctx context.Context, req *m
|
||||
if input.Filter.ActiveContract != nil {
|
||||
activeContract = input.Filter.ActiveContract
|
||||
}
|
||||
|
||||
if input.Filter.State != nil {
|
||||
profileState = input.Filter.State
|
||||
}
|
||||
}
|
||||
|
||||
signatureFilter := coredata.NewDocumentVersionSignatureFilter(signatureStates, activeContract)
|
||||
signatureFilter := coredata.NewDocumentVersionSignatureFilter(signatureStates, activeContract, profileState)
|
||||
|
||||
page, err := prb.Documents.ListSignatures(ctx, scope, input.DocumentVersionID, cursor, signatureFilter)
|
||||
if err != nil {
|
||||
|
||||
@@ -6322,6 +6322,9 @@ components:
|
||||
active_contract:
|
||||
type: boolean
|
||||
description: Signatory contract status
|
||||
state:
|
||||
$ref: "#/components/schemas/ProfileState"
|
||||
description: Signatory profile state
|
||||
|
||||
ListDocumentVersionSignaturesOutput:
|
||||
type: object
|
||||
|
||||
Reference in New Issue
Block a user