From e5bb555e01fe7357c72f4447b28eb1016d1d4203 Mon Sep 17 00:00:00 2001 From: "B.D. Murphy" <161863146+bdmurphy73@users.noreply.github.com> Date: Sun, 11 Oct 2026 21:40:02 -0700 Subject: [PATCH] Name the deleted speaker in the confirmation toast The handler read the name back out of the response, but the endpoint returns the re-rendered list as HTML, so the JSON parse fell back to a placeholder and the reviewer saw "Deleted speaker." instead of the name they clicked. The name is already known at the call site - pass it through, and drop the unused nameOf helper. Verified in a browser: "Deleted ZZ Browser Delete." --- umbraaudio/web/templates/speakers.html | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/umbraaudio/web/templates/speakers.html b/umbraaudio/web/templates/speakers.html index 8257aa3..fe93f65 100644 --- a/umbraaudio/web/templates/speakers.html +++ b/umbraaudio/web/templates/speakers.html @@ -120,10 +120,10 @@ function notify(message, isError) { // later row pointing at the wrong speaker. function deleteSpeaker(idx, name) { if (!confirm('Delete ' + name + '?')) return; - requestDelete(idx, ''); + requestDelete(idx, '', name); } -function requestDelete(idx, reassignTo) { +function requestDelete(idx, reassignTo, name) { var url = '/api/speakers/' + idx + (reassignTo ? '?reassign_to=' + encodeURIComponent(reassignTo) : ''); fetch(url, {method: 'DELETE', headers: {'HX-Request': 'true'}}) @@ -133,7 +133,7 @@ function requestDelete(idx, reassignTo) { }) .then(function (res) { if (res.status === 409) { - showReassignPrompt(idx, nameOf(res.data), res.data); + showReassignPrompt(idx, name, res.data); return; } if (res.status !== 200) { @@ -143,7 +143,7 @@ function requestDelete(idx, reassignTo) { htmx.ajax('GET', '/speakers/partial', { target: '#speakers-list', swap: 'innerHTML' }); - var msg = 'Deleted ' + nameOf(res.data) + '.'; + notify('Deleted ' + name + '.'); notify(msg); initSpeakerNames(); }) @@ -152,10 +152,6 @@ function requestDelete(idx, reassignTo) { }); } -function nameOf(data) { - return (data && data.speaker_name) || 'speaker'; -} - function showReassignPrompt(idx, name, data) { var box = document.getElementById('delete-prompt-' + idx); if (!box) { @@ -175,7 +171,7 @@ function showReassignPrompt(idx, name, data) { '