Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion plugins/controlled-documents-resources/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,22 @@ export async function completeRequest (
return
}

await client.update(req, {
const ops = client.apply(req._id)

// Check on the server side if the user has already approved - do not add the second time
// otherwise request is never finished and ends up in a broken state
ops.notMatch(reqClass, {
_id: req._id,
approved: me
})

await ops.update(req, {
$push: {
approved: me
}
})

await ops.commit()
}

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