feat(sessions): material downloads unlock when the session ends

Private materials bucket + RLS read gate (admins/own speakers anytime, all
attendees after the scheduled slot end, event-local Amsterdam time); always
visible uploaded-state, locked download panel, authenticated client downloads,
admin signed URLs. 12 new assertions in material_time_lock_tests.sql.

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-10-21 18:57:15 +02:00
1 parent 7776145a77
commit a8f3f5b8e1
13 files changed
+334 -30

No files matched your search

+4 -2
View File
@@ -80,8 +80,10 @@ client-side to avoid leaking other people's data:
- **`groupAgenda(rows)`** — turns the flat `get_agenda()` rows into
`{ slot, sessions[] }[]` ordered by slot id. Used by `useEvent()`.
- **`sessionMaterialUrl(path)`** — builds the public URL for a session material
in the `materials` bucket.
- **`downloadSessionMaterial(path)`** — downloads a material file through
authenticated storage (private bucket; server-side RLS allows it for the
session's speakers/admins anytime, everyone else after the session ended).
**`materialFilename(path)`** strips the `sessions/<id>/<ts>-` prefix.
## Admin Email Entry
+8 -3
View File
@@ -213,9 +213,14 @@ the agenda list, its slot count, and Home's Now/Next cards all agree.
and no material is uploaded yet, a **non-dismissible** "📎 Upload your session
material" notice with a file input. Uploading stores the file in the
`materials` bucket and calls `set_session_material` (via
`uploadSessionMaterial`). Once uploaded, the notice is gone and a **📎
Download material** button appears (visible to **all** attendees), pinned to
the **bottom** of the sheet's button stack (below "Pick this session").
`uploadSessionMaterial`). Once uploaded, the notice is gone. Attendees
**always see that material exists** (📎 on the agenda card, and in the
sheet), but downloads **unlock when the session ends**: before `slot end`
non-speakers see a "📎 Material uploaded — unlocks at HH:MM" panel
(`material-locked`), after it (or as the session's speaker) a **📎
Download material** button (`downloadSessionMaterial`, authenticated
storage — the private bucket's RLS enforces the same rule server-side;
attendance is irrelevant, only the clock).
- **Remove material** — a speaker of the session can also **🗑 Remove material**
(to re-upload). This deletes the storage object and clears `material_path` via
`set_session_material` (null) — `removeSessionMaterial`.