fix #14740: upload a transcript only once

A call once uploaded can no longer be sent again: claim_upload refuses a
call that already carries a CRM transcript id ("Bereits hochgeladen"),
checked under the same lock that already serializes uploads per call, so a
concurrent second upload can never slip through between the check and the
one upload it allows. upload_transcript runs this check before any HTTP
request, so a rejected re-upload never reaches the backend.

The call detail view drops "Erneut hochladen" and its confirmation dialog:
once a call has uploaded_at/crm_transcript_id, only "Hochgeladen am …" is
shown, no button.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
hauke
2026-11-06 15:40:31 +01:00
co-authored by Claude Sonnet 5
parent dad98b4558
commit fa55dcb7bc
2 changed files with 33 additions and 28 deletions
+7 -25
View File
@@ -49,7 +49,6 @@
// take a while); their errors are kept per call too.
let uploading = $state<CallId[]>([])
let uploadErrors = $state<Record<CallId, string>>({})
let confirmingUpload = $state(false)
let editingTitle = $state(false)
let titleDraft = $state('')
@@ -106,7 +105,6 @@
actionError = ''
editingTitle = false
titleError = ''
confirmingUpload = false
refreshDetail()
}
@@ -117,7 +115,6 @@
actionError = ''
editingTitle = false
titleError = ''
confirmingUpload = false
}
onMount(() => {
@@ -192,18 +189,12 @@
refreshList()
})
/** "Transkript hochladen"; an upload done before asks first. */
function uploadClick() {
if (!detail) return
if (detail.call.uploaded_at) confirmingUpload = true
else upload()
}
/** Uploads the shown call's transcript (logging in first if needed). */
/** Uploads the shown call's transcript (logging in first if needed). A
* call already uploaded has no button any more: the CRM never gets a
* duplicate. */
async function upload() {
if (!detail) return
const id = detail.call.id
confirmingUpload = false
if (uploading.includes(id)) return
uploading = [...uploading, id]
delete uploadErrors[id]
@@ -360,22 +351,14 @@
{:else if call.status === 'failed'}
<button class="btn primary" disabled={busy} onclick={retry}>Erneut versuchen</button>
<button class="btn danger" disabled={busy} onclick={discard}>Verwerfen</button>
{:else if call.status === 'done' && confirmingUpload}
<span class="confirm">Dieses Transkript wurde bereits hochgeladen. Nochmal hochladen?</span>
<button class="btn primary" onclick={upload}>Hochladen</button>
<button class="btn" onclick={() => (confirmingUpload = false)}>Abbrechen</button>
{:else if call.status === 'done'}
{:else if call.status === 'done' && !call.uploaded_at}
<button
class="btn primary"
disabled={!call.transcribed_at || isUploading}
title={call.transcribed_at ? 'Transkript ins CRM hochladen' : 'Noch kein Transkript'}
onclick={uploadClick}
onclick={upload}
>
{isUploading
? 'wird hochgeladen…'
: call.uploaded_at
? 'Erneut hochladen'
: 'Transkript hochladen'}
{isUploading ? 'wird hochgeladen…' : 'Transkript hochladen'}
</button>
{/if}
</span>
@@ -568,8 +551,7 @@
margin-left: auto;
}
.uploaded,
.confirm {
.uploaded {
font-size: 12px;
}