From 36acd2539553ee39797bc10f52228574b6926a32 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Mon, 3 Jan 2022 15:04:09 +0100 Subject: [PATCH] Disable inbox entry delete button to prevent duplicate deletion errors --- app/javascript/retrospring/features/inbox/entry/delete.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/retrospring/features/inbox/entry/delete.ts b/app/javascript/retrospring/features/inbox/entry/delete.ts index f372fd99..9167fc8a 100644 --- a/app/javascript/retrospring/features/inbox/entry/delete.ts +++ b/app/javascript/retrospring/features/inbox/entry/delete.ts @@ -7,6 +7,7 @@ import { showNotification, showErrorNotification } from 'utilities/notifications export function deleteEntryHandler(event: Event): void { const element: HTMLButtonElement = event.target as HTMLButtonElement; + element.disabled = true; const data = { id: element.getAttribute('data-ib-id') @@ -22,7 +23,10 @@ export function deleteEntryHandler(event: Event): void { cancelButtonText: I18n.translate('views.actions.cancel'), closeOnConfirm: true }, (returnValue) => { - if (returnValue === null) return false; + if (returnValue === false) { + element.disabled = false; + return; + } Rails.ajax({ url: '/ajax/delete_inbox',