feat(admin): full session material management in the session editor
See the attached file (clean name), Open (signed-URL preview), Download (authenticated blob under the original filename), Delete (confirm, storage object + path, errors surface), and Upload/Replace with previous-object cleanup and upload rollback on DB failure. Admins already passed every storage RLS gate for material writes, so no migration; this also documents and smoke-verifies insert/read/update/delete as an impersonated admin. Also fixes the stale e2e expectation that the speaker-portal download is an <a href> (it became an authenticated blob button with the private bucket).
This commit is contained in:
1 parent
246be7d787
commit
ca88c0e564
5 files changed
+150
-43
No files matched your search
@@ -88,14 +88,15 @@ test.describe('Speaker portal', () => {
|
||||
await expect(page.getByText('Future talk', { exact: true })).toBeVisible();
|
||||
await expect(page.getByTestId('checkin-required-gate')).toHaveCount(0);
|
||||
await article.getByLabel(`Upload material for ${title}`).setInputFiles({ name: 'slides.txt', mimeType: 'text/plain', buffer: Buffer.from('First slides') });
|
||||
await expect(article.getByRole('link', { name: 'Download material' })).toBeVisible();
|
||||
await expect(article.getByRole('button', { name: 'Download material' })).toBeVisible();
|
||||
const firstPath = materialPath;
|
||||
await article.getByLabel(`Replace material for ${title}`).setInputFiles({ name: 'slides.txt', mimeType: 'text/plain', buffer: Buffer.from('Replacement slides') });
|
||||
await expect.poll(() => uploaded.length).toBe(2);
|
||||
await expect(article.getByRole('button', { name: 'Remove material' })).toBeEnabled();
|
||||
expect(materialPath).not.toBe(firstPath);
|
||||
expect(removed).toEqual([firstPath]);
|
||||
await expect(article.getByRole('link', { name: 'Download material' })).toHaveAttribute('href', new RegExp(`${materialPath}$`));
|
||||
// Authenticated blob download (private bucket) — a button, no href anymore.
|
||||
await expect(article.getByRole('button', { name: 'Download material' })).toBeEnabled();
|
||||
await page.screenshot({ path: `/tmp/convivo-speaker-${width}-${title.split(' ')[0]}.png`, fullPage: true });
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true);
|
||||
page.once('dialog', (dialog) => dialog.accept());
|
||||
|
||||
Reference in new issue
Block a user