package main // The columns and icons spec's mutations for a page's look (ยง9): the // attach rule's record clause, the look's own image check, and the // small-image cache's place after the read rule. const ( looks = "internal/mapa/looks.go" looksImages = "internal/mapa/looks_images.go" imagesHTTP = "internal/mapa/handlers_images.go" ) var lookMutations = []mutation{ {gate: "LOOK5", test: "TestLookImagesAreKeptAndStampedAsBodyImagesAre", pkg: inside, name: "the record's icon is not a reference", edits: []edit{{file: looks, from: "\tif record.Icon != nil && record.Icon.Image != \"\" {", to: "\tif record.Icon != nil && false {"}}}, {gate: "LOOK4", test: "TestALookNamesOnlyTheSettersOwnOrThisPagesImages", pkg: inside, name: "a look names any image", edits: []edit{{file: looksImages, from: "\tif row.ID == 0 {\n\t\treturn ErrNotFound\n\t}", to: "\tif row.ID < 0 {\n\t\treturn ErrNotFound\n\t}"}, { file: looksImages, from: "\t\t\"owner_id = ?) OR page_id = ?)\", " + "public, actor, page.ID).", to: "\t\t\"owner_id != ?) OR page_id != ?)\", " + "public, actor, page.ID)."}}}, {gate: "LOOK12", test: "TestLook12ACachedPictureStillAnswersToTheReadRule", name: "a cached picture skips the read rule", edits: []edit{{file: imagesHTTP, from: "\trow, err := app.store.ReadableImage(" + "request.Context(), viewer, id)", to: "\tif data, kind, ok := app.store.small.get(id); ok {\n" + "\t\twriter.Header().Set(\"Content-Type\", kind)\n" + "\t\t_, _ = writer.Write(data)\n\t\treturn\n\t}\n" + "\trow, err := app.store.ReadableImage(" + "request.Context(), viewer, id)"}}}, }