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.
This commit is contained in:
1 parent
a2b87602b4
commit
d4e4637e7c
13 files changed
+334
-30
No files matched your search
@@ -610,6 +610,30 @@ in `transform-excel.test.js`; verified against the real Sessionize demo payload
|
||||
(10/11 sessions get a language, service sessions stay null → now forced
|
||||
English by the RPCs).
|
||||
|
||||
## Material downloads unlock at the session end — ✅ complete (2026-10-21)
|
||||
|
||||
Product rule (Sabrina): uploaded session material must not distract attendees
|
||||
mid-session, but must be available to **everyone** (time-based, attendance not
|
||||
required) once the session's schedule ends — and users must always *see* that
|
||||
a speaker uploaded material even while the download is locked.
|
||||
|
||||
- **Enforced at the storage layer**, not the UI: `20261021180000_material_time_lock.sql`
|
||||
makes the `materials` bucket **private** and replaces `materials_read` with
|
||||
`can_read_session_material(bucket, name)`: admins and the session's own
|
||||
speakers anytime; everyone else only after `slot_date + end_time`
|
||||
(Europe/Amsterdam wall time, matching the client's existing `slotStatus ===
|
||||
'done'` rule). A leaked path/URL releases nothing early.
|
||||
- **Always-visible existence**: the agenda card 📎 pill already renders from
|
||||
`material_path` (unchanged, `get_agenda` still returns it); SessionDetail
|
||||
shows a "📎 Material uploaded — unlocks at HH:MM" panel (`material-locked`)
|
||||
while locked, and a download button once unlocked or for the speaker.
|
||||
- **Clients**: attendee app downloads via authenticated
|
||||
`storage.from('materials').download()` (blob + filename); admin app switched
|
||||
to short-lived `createSignedUrl`. No `getPublicUrl` remains in any app.
|
||||
- **Tests**: `supabase/tests/material_time_lock_tests.sql` — 12 assertions
|
||||
(bucket private, outsider locked/unlocked by time, speaker/admin bypass,
|
||||
malformed/foreign-bucket rejection, event-local boundary, anon exclusion).
|
||||
|
||||
## Known work (open as of 2026-10-19)
|
||||
|
||||
- **E2E seed drift — 42 specs currently red.** The pretix reseed removed the
|
||||
|
||||
Reference in new issue
Block a user