mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-14 05:28:39 +00:00
fix: allow modals to be submitted multiple times (#11843)
Fixes #11842. The `once: true` was likely added to prevent multiple concurrent submissions of the same form. This could still be worth preventing, but I suspect it would require wrapping the supplied `onApprove` callback with the corresponding logic, implemented manually, as I am not aware of any native API to prevent concurrent executions of callbacks. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11843 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu> Co-committed-by: Antonin Delpeuch <antonin@delpeuch.eu>
This commit is contained in:
parent
9e3c3e5d53
commit
3763a88c67
2 changed files with 21 additions and 1 deletions
|
|
@ -13,7 +13,7 @@ export function showModal(modalID: string, onApprove: () => void) {
|
|||
modal.querySelector('.cancel')?.addEventListener('click', () => {
|
||||
modal.close();
|
||||
}, {once: true, passive: true});
|
||||
modal.querySelector('.ok')?.addEventListener('click', onApprove, {once: true, passive: true});
|
||||
modal.querySelector('.ok')?.addEventListener('click', onApprove, {passive: true});
|
||||
|
||||
// The modal is ready to be shown.
|
||||
modal.showModal();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue