Skip to content

Commit 1b81824

Browse files
fix(Sign): show drawing prompt in GRAPHIC_ONLY mode without placed element
needCreateSignature computed was duplicating the validator logic and also required a placed visual element box, so it returned false for clickToSign documents in GRAPHIC_ONLY mode. Added signerHasSignRequest computed (true when the current user has a signRequestId) and pass it to requirementValidator.getFirstUnmetRequirement() in both confirmSignDocument and executeSigningAction so the validator can prompt for the signature drawing even when no element box was placed. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 3f7d0dd commit 1b81824

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

src/views/SignPDF/_partials/Sign.vue

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -268,32 +268,24 @@ export default {
268268
return this.elements.length > 0
269269
},
270270
needCreateSignature() {
271+
if (!this.canCreateSignature || this.hasSignatures) {
272+
return false
273+
}
271274
const document = this.signStore.document || {}
272275
const signer = document?.signers?.find(row => row.me) || {}
273-
274-
const signRequestIds = new Set()
275-
if (signer.signRequestId) {
276-
signRequestIds.add(String(signer.signRequestId))
277-
}
278-
if (Array.isArray(document?.files)) {
279-
document.files
280-
.flatMap(file => getFileSigners(file))
281-
.filter(row => row.me && row.signRequestId)
282-
.forEach(row => signRequestIds.add(String(row.signRequestId)))
283-
}
284-
285-
const visibleElements = getVisibleElementsFromDocument(document)
286-
return signRequestIds.size > 0
287-
&& visibleElements.some(row => signRequestIds.has(String(row.signRequestId)))
288-
&& !this.hasSignatures
289-
&& this.canCreateSignature
276+
return !!signer.signRequestId
290277
},
291278
needIdentificationDocuments() {
292279
return this.identificationDocumentStore.showDocumentsComponent()
293280
},
294281
canCreateSignature() {
295282
return getCapabilities()?.libresign?.config?.['sign-elements']?.['can-create-signature'] === true
296283
},
284+
signerHasSignRequest() {
285+
const doc = this.signStore.document || {}
286+
const signer = doc?.signers?.find(row => row.me) || {}
287+
return !!signer.signRequestId
288+
},
297289
ableToSign() {
298290
return this.signStore.ableToSign
299291
},
@@ -520,6 +512,7 @@ export default {
520512
errors: this.signStore.errors,
521513
hasSignatures: this.hasSignatures,
522514
canCreateSignature: this.canCreateSignature,
515+
signerHasSignRequest: this.signerHasSignRequest,
523516
})
524517
525518
const result = this.actionHandler.handleAction('sign', { unmetRequirement })
@@ -544,6 +537,7 @@ export default {
544537
errors: this.signStore.errors,
545538
hasSignatures: this.hasSignatures,
546539
canCreateSignature: this.canCreateSignature,
540+
signerHasSignRequest: this.signerHasSignRequest,
547541
})
548542
549543
const config = unmetRequirement ? { unmetRequirement } : {}

0 commit comments

Comments
 (0)