Add Drive folders: per request type, and managed from the Media page

Request files go in Requests/<type> (Chapters, Events...). Media →
Files shows a tab per folder under Media, up to three deep, and can
make, rename (files follow) and delete empty folders, move a file with
its Folder dropdown, and upload into the folder showing; Choose a file
has the same tabs. A folder made, or a file moved, in Drive by hand is
followed on the next look (migration 050 records each file's folder).

Deletes now move to Drive's trash: a shared drive's Content manager,
the service account's role, can't delete outright, so request and file
deletes would have failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-29 22:34:27 -05:00
parent 9854da965e
commit 7f05076a86
7 changed files with 479 additions and 38 deletions

View file

@ -60,8 +60,8 @@ hand.
| Folder | Used by | Set in |
| --- | --- | --- |
| `Requests` | Files sent with the Request form | `DRIVE_FOLDER` in `server/src/routes/requests.js` |
| `Media` | Files for pages to link to (Tools → Media → Files) | `FOLDER` in `server/src/routes/files.js` |
| `Requests/<type>` | Files sent with the Request form, a folder per type (`Requests/Chapters`, `Requests/Blog posts`...) | `DRIVE_FOLDER` and `TYPE_FOLDERS` in `server/src/routes/requests.js` |
| `Media` and folders in it | Files for pages to link to (Tools → Media → Files), in folders you make there | `FOLDER` in `server/src/routes/files.js` |
A new use calls `driveUpload("<Folder>", name, mime, bytes)` from
`server/src/googleService.js`; a path such as `"Media/2026"` makes each
@ -78,7 +78,14 @@ folders to the drive; the site ignores them.
Request files are named `Request 12 - original name.docx`, so the number
matches the one in Forms → Content requests. Deleting a request in the
admin deletes its files from Drive too.
admin deletes its files from Drive too. Request files from before the
per-type folders stay where they are, in `Requests` itself.
**Deleting means Drive's trash.** Whatever the admin deletes (a
request's files, a file, an empty folder) goes to the shared drive's
trash, which keeps it 30 days; restore it from there if needed. A
shared drive's Content manager, the service account's role, can trash
but not permanently delete.
## 3. Gmail (domain-wide delegation)
@ -201,7 +208,14 @@ Drive" above the title.
and shortcuts don't. A file Drive won't share with anyone who has the
link is named in a red note instead of listed, and tried again every
ten minutes.
- Deleting a file in the admin deletes it from Drive; the delete says
- **Folders:** Media → Files has a tab per folder under `Media` (up to
three deep), and uploads go into the one showing. **New folder** makes
one inside it, **Rename** renames it (and everything in it follows),
and **Delete** (admins and up) removes it once it's empty. Each file
has a Folder dropdown to move it. Choose a file has the same tabs. A
folder made in Drive itself, and a file moved there by hand, show up
on the next look.
- Deleting a file in the admin moves it to Drive's trash; the delete says
first which records still link to it (those links stop working).
Deleting it in Drive by hand leaves a broken link and a list entry
that can still be deleted.