Fix wrong-picture bug: thumbs keyed by sha256 (was filename); single-item actions via fetch+remove (reliable)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user