Skip to content

Commit c6deabe

Browse files
authored
Qfix: double approval of review/approve request (#10199)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
1 parent 225f603 commit c6deabe

File tree

1 file changed

+12
-1
lines changed
  • plugins/controlled-documents-resources/src

1 file changed

+12
-1
lines changed

plugins/controlled-documents-resources/src/utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,22 @@ export async function completeRequest (
443443
return
444444
}
445445

446-
await client.update(req, {
446+
const ops = client.apply(req._id)
447+
448+
// Check on the server side if the user has already approved - do not add the second time
449+
// otherwise request is never finished and ends up in a broken state
450+
ops.notMatch(reqClass, {
451+
_id: req._id,
452+
approved: me
453+
})
454+
455+
await ops.update(req, {
447456
$push: {
448457
approved: me
449458
}
450459
})
460+
461+
await ops.commit()
451462
}
452463

453464
export async function saveComment (message: Markup | undefined, req: DocumentRequest): Promise<void> {

0 commit comments

Comments
 (0)