Fix wrong-picture bug: thumbs keyed by sha256 (was filename); single-item actions via fetch+remove (reliable)

This commit is contained in:
2026-08-09 15:48:22 +10:00
parent 73f6f291f1
commit d2a58caca6
3 changed files with 54 additions and 41 deletions

View File

@@ -143,6 +143,25 @@
refresh();
});
async function cardAction(action, btn) {
const card = btn.closest('.card');
const sha = card.dataset.sha;
try {
const resp = await fetch(`/review/${sha}/${action}`, { method: 'POST' });
if (resp.ok) {
card.remove();
updateCount();
showToast(action === 'approve' ? 'Approved' : action === 'reject' ? 'Rejected' : 'Reset');
// if reset, refresh the page (item returns to a different view)
if (action === 'reset') location.reload();
} else {
showToast('Action failed', true);
}
} catch (e) {
showToast('Action failed: ' + e, true);
}
}
async function bulk(action) {
const shas = getSelected();
if (shas.length === 0) return;