fix(quarantine): manager-tab approve immediately marks task completed

When approving from the quarantine manager (no task_id in request), the
re-import ran through the simple pipeline path with no task to update, so
the downloads list stayed on 'failed' until the batch drained.

Scan download_tasks for the task whose quarantine_entry_id matches the
approved entry. If found, re-run through the verification wrapper with that
task_id so the task is marked completed immediately in the live downloads list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dev 2026-06-24 13:05:25 +02:00
parent 8f66432592
commit 83f21b248d

View file

@ -7640,6 +7640,17 @@ def approve_quarantine_item(entry_id):
_t = download_tasks.get(_task_id)
if isinstance(_t, dict):
_batch_id = _t.get('batch_id')
else:
# Manager-tab approve: no task_id in the request. Find the task that
# owns this quarantine entry so the re-import marks it completed in
# the downloads list without waiting for the batch to finish.
with tasks_lock:
for _tid, _t in download_tasks.items():
if isinstance(_t, dict) and _t.get('quarantine_entry_id') == entry_id:
_task_id = _tid
_batch_id = _t.get('batch_id')
break
if _task_id:
context['task_id'] = _task_id
if _batch_id:
context['batch_id'] = _batch_id