fix(watch): a link whose video is being made again says so, in the page's language

The public watch route answers video_preparing for an asset that is pending or
downloading, and the page shows "being prepared — try again" with a Retry
instead of "this link is gone". watch.html ships one lang; the page now sets
documentElement.lang to the language its strings were picked in.
This commit is contained in:
2026-10-06 03:19:32 +02:00
parent 68cfc7e25d
commit dba4758c59
7 changed files with 96 additions and 10 deletions
@@ -211,6 +211,26 @@ describe("WatchPage honest failures", () => {
expect(page.queryByRole("button", { name: "Try again" })).toBeNull();
});
it("a 404 whose video is being made again says to come back, with a retry", async () => {
window.history.replaceState({}, "", "/watch/tok-preparing");
vi.stubGlobal(
"fetch",
vi
.fn()
.mockResolvedValueOnce(res(404, { detail: { code: 404, reason: "video_preparing" } }))
.mockResolvedValue(
res(200, { needs_password: false, file_url: "/f.mp4", title: "A clip" }),
),
);
const page = render(<WatchPage />);
const retry = await page.findByRole("button", { name: "Try again" });
expect(page.getByRole("status").textContent).toContain("This video is being prepared.");
expect(page.queryByText(GONE)).toBeNull();
fireEvent.click(retry);
await waitFor(() => expect(page.container.querySelector("video")).not.toBeNull());
});
async function tryPassword(second: () => Promise<unknown>) {
vi.stubGlobal(
"fetch",