uga buga kaka
This commit is contained in:
@@ -2673,6 +2673,24 @@ window.initUploadForm = (selector) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Immediately inject the new item into the main grid using the HTTP response data.
|
||||||
|
// This eliminates the SSE race condition where the async new_item event could
|
||||||
|
// arrive during or after page navigation and be silently lost.
|
||||||
|
if (lastData && !lastData.manual_approval && !lastData.pending &&
|
||||||
|
lastData.itemid && lastData.dest && lastData.mime &&
|
||||||
|
window.NotificationSystemInstance &&
|
||||||
|
typeof window.NotificationSystemInstance.handleNewItem === 'function') {
|
||||||
|
window.NotificationSystemInstance.handleNewItem({
|
||||||
|
id: lastData.itemid,
|
||||||
|
dest: lastData.dest,
|
||||||
|
mime: lastData.mime,
|
||||||
|
username: lastData.username || window.f0ckSession?.user || '',
|
||||||
|
display_name: lastData.display_name || window.f0ckSession?.display_name || null,
|
||||||
|
tag_id: lastData.tag_id ?? 0,
|
||||||
|
is_oc: !!lastData.is_oc
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Skip redirect if every item was a background URL job
|
// Skip redirect if every item was a background URL job
|
||||||
const allPending = lastData?.pending && selectedFiles.every(i => i.type === 'url');
|
const allPending = lastData?.pending && selectedFiles.every(i => i.type === 'url');
|
||||||
if (!allPending) {
|
if (!allPending) {
|
||||||
|
|||||||
@@ -775,7 +775,14 @@ export const handleUpload = async (req, res, self) => {
|
|||||||
manual_approval: manualApproval,
|
manual_approval: manualApproval,
|
||||||
redirect: !manualApproval ? `/${itemid}` : null,
|
redirect: !manualApproval ? `/${itemid}` : null,
|
||||||
url: !manualApproval ? `${cfg.main.url.full}/${itemid}` : `${cfg.main.url.full}/`,
|
url: !manualApproval ? `${cfg.main.url.full}/${itemid}` : `${cfg.main.url.full}/`,
|
||||||
file_url: !manualApproval ? `${cfg.main.url.full}${imagesPath}/${filename}` : null
|
file_url: !manualApproval ? `${cfg.main.url.full}${imagesPath}/${filename}` : null,
|
||||||
|
// Fields for immediate client-side grid injection (avoids SSE race condition)
|
||||||
|
dest: filename,
|
||||||
|
mime: actualMime,
|
||||||
|
tag_id: effectiveRating ? (effectiveRating === 'sfw' ? 1 : (effectiveRating === 'nsfw' ? 2 : (cfg.nsfl_tag_id || 3))) : 0,
|
||||||
|
is_oc: !!is_oc,
|
||||||
|
display_name: req.session.display_name || null,
|
||||||
|
username: req.session.user
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user