Allow staff to upload photos has another user.
All checks were successful
Docker / build (release) Successful in 9s

This commit is contained in:
krek0 2026-05-16 19:02:52 +02:00
parent b0027be96c
commit 1de1cb4086
4 changed files with 48 additions and 14 deletions

View file

@ -95,11 +95,12 @@ pausebtn.addEventListener('click', () => {
pausebtn.className = pause ? 'btn btn-success' : 'btn btn-warning';
});
async function uploadFile(file, galleryID, csrfvalue) {
async function uploadFile(file, galleryID, csrfvalue, ownerID) {
const sendform = new FormData();
sendform.append('csrfmiddlewaretoken', csrfvalue);
sendform.append('file_field', file);
sendform.append('gallery', galleryID);
if (ownerID) sendform.append('owner', ownerID);
const start = performance.now();
const res = await fetch('/upload/', {
method: 'POST',
@ -146,6 +147,8 @@ ctnbtn.addEventListener('click', async () => {
}
const galleryID = returned.galleryID;
const ownerSelect = document.getElementById('id_owner');
const ownerID = ownerSelect ? ownerSelect.value : null;
uploadInput.disabled = true;
gallerySelect.disabled = true;
@ -194,7 +197,7 @@ ctnbtn.addEventListener('click', async () => {
while (!pause && active < concurrency && queue.length > 0) {
const file = queue.shift();
active++;
uploadFile(file, galleryID, csrfvalue)
uploadFile(file, galleryID, csrfvalue, ownerID)
.catch(e => console.error(e))
.finally(() => { completed++; tuneConcurrency(); active--; updateProgress(); next(); });
}