feat(events): show every photo on the event page without folders
CI / build (push) Has been cancelled
CI / build (push) Has been cancelled
Folders were an implementation detail leaking into the event workflow: every upload needed a folder first and photos were split across pages. Uploads now land in a single implicit "Photos" folder and the event page renders one gallery with the uploader and an edited-only download. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
+7
-15
@@ -4,8 +4,8 @@ import { signInAs, resetDb, BASE } from "./dev";
|
||||
|
||||
/**
|
||||
* Event photography (J/K slice): a coordinator creates an event and assigns two
|
||||
* photographers; the first creates a folder and uploads an edited JPEG plus a
|
||||
* RAW original; the second — not the uploader — downloads the untouched bytes.
|
||||
* photographers; the first uploads a JPEG and a RAW original straight onto the
|
||||
* event page; the second — not the uploader — downloads the untouched bytes.
|
||||
* An unassigned volunteer cannot open the event at all.
|
||||
*/
|
||||
|
||||
@@ -56,17 +56,13 @@ test.describe("event photo sharing", () => {
|
||||
await expect(page.getByText("Sam Okafor").first()).toBeVisible();
|
||||
});
|
||||
|
||||
test("an assigned photographer creates a folder and uploads files", async ({
|
||||
test("an assigned photographer uploads files on the event page", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1200, height: 900 });
|
||||
await signInAs(page, "avery@glenloch.local");
|
||||
await page.goto(eventUrl);
|
||||
|
||||
await page.getByLabel("New folder").fill("Originals");
|
||||
await page.getByRole("button", { name: "Create folder" }).click();
|
||||
await page.getByRole("link", { name: /Originals/ }).click();
|
||||
|
||||
await page.getByLabel("Choose photos to upload").setInputFiles([
|
||||
{ name: PHOTO_NAME, mimeType: "image/jpeg", buffer: PHOTO },
|
||||
{ name: "raw.CR3", mimeType: "application/octet-stream", buffer: RAW },
|
||||
@@ -84,11 +80,9 @@ test.describe("event photo sharing", () => {
|
||||
await page.setViewportSize({ width: 1200, height: 900 });
|
||||
await signInAs(page, "sam@glenloch.local");
|
||||
await page.goto(eventUrl);
|
||||
await page.getByRole("link", { name: /Originals/ }).click();
|
||||
|
||||
const [download] = await Promise.all([
|
||||
page.waitForEvent("download"),
|
||||
// Exact: the folder header also offers "Download folder (n)".
|
||||
page.getByRole("link", { name: "Download", exact: true }).first().click(),
|
||||
]);
|
||||
const downloadPath = await download.path();
|
||||
@@ -112,11 +106,11 @@ test.describe("event photo sharing", () => {
|
||||
|
||||
const zip = await readFile(downloadPath!);
|
||||
expect(zip.subarray(0, 4).toString("binary")).toBe("PK\x03\x04");
|
||||
// Store-only entries keep the original bytes and folder paths in the ZIP.
|
||||
// Store-only entries keep the original bytes; uploads share one folder.
|
||||
expect(zip.includes(PHOTO)).toBe(true);
|
||||
expect(zip.includes(RAW)).toBe(true);
|
||||
expect(zip.includes(Buffer.from(`Originals/${PHOTO_NAME}`))).toBe(true);
|
||||
expect(zip.includes(Buffer.from("Originals/raw.CR3"))).toBe(true);
|
||||
expect(zip.includes(Buffer.from(`Photos/${PHOTO_NAME}`))).toBe(true);
|
||||
expect(zip.includes(Buffer.from("Photos/raw.CR3"))).toBe(true);
|
||||
});
|
||||
|
||||
test("a photographer views a photo and saves a full-resolution edited JPEG", async ({
|
||||
@@ -125,7 +119,6 @@ test.describe("event photo sharing", () => {
|
||||
await page.setViewportSize({ width: 1200, height: 900 });
|
||||
await signInAs(page, "sam@glenloch.local");
|
||||
await page.goto(eventUrl);
|
||||
await page.getByRole("link", { name: /Originals/ }).click();
|
||||
|
||||
await page
|
||||
.getByRole("button", { name: `View and edit ${PHOTO_NAME}` })
|
||||
@@ -164,7 +157,7 @@ test.describe("event photo sharing", () => {
|
||||
]);
|
||||
const zip = await readFile((await zipDownload.path())!);
|
||||
expect(zip.includes(edited)).toBe(true);
|
||||
expect(zip.includes(Buffer.from("Originals/photo-edited.jpg"))).toBe(true);
|
||||
expect(zip.includes(Buffer.from("Photos/photo-edited.jpg"))).toBe(true);
|
||||
});
|
||||
|
||||
test("an unassigned volunteer cannot open the event", async ({ page }) => {
|
||||
@@ -178,7 +171,6 @@ test.describe("event photo sharing", () => {
|
||||
await page.setViewportSize({ width: 1200, height: 900 });
|
||||
await signInAs(page, "admin@glenloch.local");
|
||||
await page.goto(eventUrl);
|
||||
await page.getByRole("link", { name: /Originals/ }).click();
|
||||
const photoHref = await page
|
||||
.getByRole("link", { name: "Download", exact: true })
|
||||
.first()
|
||||
|
||||
Reference in New Issue
Block a user