Skip to content

Commit

Permalink
fix: prevent insert when update element
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Apr 12, 2024
1 parent 81737af commit 6862723
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,15 @@ public function patchSignatureElement($nodeId, string $type = '', array $file =
$element['file'] = $file;
}
$this->validateHelper->validateVisibleElement($element, $this->validateHelper::TYPE_VISIBLE_ELEMENT_USER);
$this->accountService->saveVisibleElement($element, $this->sessionService->getSessionId(), $this->userSession->getUser());
$user = $this->userSession->getUser();
if ($user instanceof IUser) {
$userElement = $this->signerElementsService->getUserElementByNodeId(
$user->getUID(),
$nodeId,
);
$element['elementId'] = $userElement['id'];
}
$this->accountService->saveVisibleElement($element, $this->sessionService->getSessionId(), $user);
return new JSONResponse(
[
'message' => $this->l10n->t('Element updated with success')
Expand Down

0 comments on commit 6862723

Please sign in to comment.