Manage request files: mark missing ones, remove them, list them all

Forms → Content requests and a new Tools → Media → Requests tab (by
type folder, each linked to its request) mark a file Drive no longer
has under Requests as Missing from Drive. Remove (admins and up)
trashes a file and takes it off its request. Drive is asked at most
every 30 seconds, and folder lookups now cache every level walked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-29 23:25:58 -05:00
parent 9ff1cd6e99
commit e1542d8d87
6 changed files with 292 additions and 32 deletions

View file

@ -143,7 +143,12 @@ export function forgetFolders(path) {
async function findOrMakeFolder(path) {
const drive = process.env.GOOGLE_SHARED_DRIVE;
let parent = drive;
const walked = [];
for (const name of path.split("/").filter(Boolean)) {
// Each level on the way is known too: "Requests" once
// "Requests/Chapters" has been found.
if (walked.length && !folders.has(walked.join("/"))) folders.set(walked.join("/"), Promise.resolve(parent));
walked.push(name);
const quoted = name.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
const query = new URLSearchParams({
q: `name = '${quoted}' and mimeType = '${FOLDER}' and '${parent}' in parents and trashed = false`,