fix(home): shelf honours the Plex gate; hero unpins its origin; palette asks for a surprise
- A13: with Plex off, the Home shelf and the hero's comfort tier go YouTube-only like the rails beside them (owner's call: hide the tiles). The pins are kept; GET /pins still lists them. - Reorder deals the listed pins into the slots they already hold, so a partial list (hidden Plex pins, a stale tab) no longer puts two pins on one position; repeats are ignored. - A21: a comfort hero carries `pinned_from`, the shelf entry it was resolved from; its menu acts on that pin, so a pinned show's next episode offers "Unpin" instead of creating a second pin. - B12: the palette's "Meglepetés" asks for the surprise tier (the next press leading with it); the rotation carries on from there. - B13: the surprise token names the history entry it was requested for (minted by setPage's new `then`, after the push) and is dropped on any other entry, so a navigation that never mounted Home cannot replay it later.
This commit is contained in:
@@ -61,6 +61,7 @@ vi.mock("../lib/api", () => ({
|
||||
},
|
||||
HttpError: class extends Error {},
|
||||
DISCOVER_BUDGETS: ["short", "medium", "long", "any"],
|
||||
HERO_TIERS: ["resume", "comfort", "surprise"],
|
||||
discoverCardKey: (c: { source: string; id: string }) => `${c.source}:${c.id}`,
|
||||
}));
|
||||
|
||||
@@ -302,6 +303,34 @@ describe("Home — the comfort shelf's context menu", () => {
|
||||
await waitFor(() => expect(removeComfortPin).toHaveBeenCalledWith(11));
|
||||
});
|
||||
|
||||
// A comfort hero resolved from a pinned SHOW is that show's next episode, which is not itself
|
||||
// pinned: the menu looked the episode up, missed, and offered "Pin" under "From your shelf" —
|
||||
// taking it created a second pin. The card now names the pin it came from, and the row acts on
|
||||
// THAT (owner's call, 2026-09-19: "Unpin").
|
||||
it("unpins the SHOW a comfort hero's episode was resolved from", async () => {
|
||||
const show = {
|
||||
...base("ps1", "Pinned show"),
|
||||
source: "plex",
|
||||
kind: "show",
|
||||
video: null,
|
||||
pin_id: 21,
|
||||
};
|
||||
const episode = {
|
||||
...base("ps1e2", "Next episode"),
|
||||
source: "plex",
|
||||
kind: "episode",
|
||||
video: null,
|
||||
pinned_from: { source: "plex", kind: "show", id: "ps1", title: "Pinned show" },
|
||||
};
|
||||
discover.mockResolvedValue({ ...payload(), hero: { tier: "comfort", card: episode } });
|
||||
comfortPins.mockResolvedValue({ items: [...shelf, show] });
|
||||
mount();
|
||||
fireEvent.contextMenu(await screen.findByText("Next episode"));
|
||||
fireEvent.click(await waitFor(() => item("home.pin.remove")));
|
||||
await waitFor(() => expect(removeComfortPin).toHaveBeenCalledWith(21));
|
||||
expect(addComfortPin).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("says so rather than guessing while the shelf is still loading", async () => {
|
||||
// "Not pinned" and "not known yet" must not render as the same row: the pin label is only
|
||||
// trustworthy once the shelf has answered.
|
||||
|
||||
Reference in New Issue
Block a user