mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-17 21:12:16 +01:00
Merge pull request #6160 from LibreSign/fix/individual-signer-status-control
fix: add ordering validation for signature request actions
This commit is contained in:
commit
9c6cebf5f5
1 changed files with 33 additions and 11 deletions
|
|
@ -263,20 +263,28 @@ export default {
|
|||
},
|
||||
canRequestSignature() {
|
||||
return (signer) => {
|
||||
return this.filesStore.canRequestSign
|
||||
&& !signer.signed
|
||||
&& signer.signRequestId
|
||||
&& !signer.me
|
||||
&& signer.status === 0
|
||||
if (!this.filesStore.canRequestSign
|
||||
|| signer.signed
|
||||
|| !signer.signRequestId
|
||||
|| signer.me
|
||||
|| signer.status !== 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return this.canSignerActInOrder(signer)
|
||||
}
|
||||
},
|
||||
canSendReminder() {
|
||||
return (signer) => {
|
||||
return this.filesStore.canRequestSign
|
||||
&& !signer.signed
|
||||
&& signer.signRequestId
|
||||
&& !signer.me
|
||||
&& signer.status === 1
|
||||
if (!this.filesStore.canRequestSign
|
||||
|| signer.signed
|
||||
|| !signer.signRequestId
|
||||
|| signer.me
|
||||
|| signer.status !== 1) {
|
||||
return false
|
||||
}
|
||||
|
||||
return this.canSignerActInOrder(signer)
|
||||
}
|
||||
},
|
||||
showSaveButton() {
|
||||
|
|
@ -353,6 +361,21 @@ export default {
|
|||
getSvgIcon(name) {
|
||||
return iconMap[`svg${name.charAt(0).toUpperCase() + name.slice(1)}`] || iconMap.svgAccount
|
||||
},
|
||||
canSignerActInOrder(signer) {
|
||||
if (!this.isOrderedNumeric) {
|
||||
return true
|
||||
}
|
||||
|
||||
const file = this.filesStore.getFile()
|
||||
const signerOrder = signer.signingOrder || 1
|
||||
|
||||
const hasPendingLowerOrder = file.signers.some(s => {
|
||||
const otherOrder = s.signingOrder || 1
|
||||
return otherOrder < signerOrder && !s.signed
|
||||
})
|
||||
|
||||
return !hasPendingLowerOrder
|
||||
},
|
||||
enabledMethods() {
|
||||
return this.methods.filter(method => method.enabled)
|
||||
},
|
||||
|
|
@ -473,7 +496,6 @@ export default {
|
|||
await this.filesStore.updateSignatureRequest({
|
||||
visibleElements: [],
|
||||
signers,
|
||||
status: 1,
|
||||
})
|
||||
showSuccess(t('libresign', 'Signature requested'))
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue