Skip to content

Commit

Permalink
fix(signature-collection): Fix paper signatures for candidacy (#16411)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and kksteini committed Oct 16, 2024
1 parent 91c70f8 commit a5d88ae
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ export class SignatureCollectionService {
const canSign =
signatureSignee.canSign ||
(signatureSignee.canSignInfo?.length === 1 &&
signatureSignee.canSignInfo[0] === ReasonKey.AlreadySigned)
(signatureSignee.canSignInfo[0] === ReasonKey.AlreadySigned ||
signatureSignee.canSignInfo[0] === ReasonKey.noInvalidSignature))

return canSign && list.area.id === signatureSignee.area?.id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ export class SignatureCollectionSharedClientService {
const signatures = await api.medmaelalistarIDMedmaeliGet({
iD: parseInt(listId),
})
return signatures
.map((signature) => mapSignature(signature))
.filter((s) => s.valid)
return signatures.map((signature) => mapSignature(signature))
}

canCreate({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,23 +277,29 @@ export class SignatureCollectionClientService {
pageNumber,
}: { listId: string; nationalId: string; pageNumber: number },
): Promise<Success> {
const newSignature = await this.getApiWithAuth(
this.listsApi,
auth,
).medmaelalistarIDMedmaeliBulkPost({
medmaeliBulkRequestDTO: {
medmaeli: [
{
kennitala: nationalId,
bladsida: pageNumber,
},
],
},
iD: parseInt(listId),
})
try {
await this.getApiWithAuth(
this.listsApi,
auth,
).medmaelalistarIDMedmaeliBulkPost({
medmaeliBulkRequestDTO: {
medmaeli: [
{
kennitala: nationalId,
bladsida: pageNumber,
},
],
},
iD: parseInt(listId),
})

return {
success: !!newSignature.medmaeliKenn?.includes(nationalId),
return {
success: true,
}
} catch {
return {
success: false,
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const PaperSignees = ({
},
},
onCompleted: (res) => {
if (res.success) {
if (res.signatureCollectionUploadPaperSignature?.success) {
toast.success(formatMessage(m.paperSigneeSuccess))
refetchSignees()
} else {
Expand Down

0 comments on commit a5d88ae

Please sign in to comment.