diff --git a/src/components/playlist/PlaylistCard.tsx b/src/components/playlist/PlaylistCard.tsx index 1e026ffb..c5b9e999 100644 --- a/src/components/playlist/PlaylistCard.tsx +++ b/src/components/playlist/PlaylistCard.tsx @@ -29,6 +29,12 @@ export interface PlaylistCardProps { onDelete?: () => void; /** Hides the owner link and the unread dot. */ isOwner?: boolean; + /** + * Used by dump pages to display "In collections" lists. Prevents the + * visibility badge from showing, except to the owner of a private playlist: + * public badges on every card there would say nothing. + */ + privateBadgeOnly?: boolean; } /** @@ -37,12 +43,13 @@ export interface PlaylistCardProps { * device. The card is an `
  • `, for a ` diff --git a/src/pages/Dump.tsx b/src/pages/Dump.tsx index 40b064bf..e87f8292 100644 --- a/src/pages/Dump.tsx +++ b/src/pages/Dump.tsx @@ -569,7 +569,7 @@ export function Dump(): React.JSX.Element {

    In collections

    - + )} diff --git a/src/test/components/playlist/PlaylistCard.test.tsx b/src/test/components/playlist/PlaylistCard.test.tsx index abcc6871..6b808639 100644 --- a/src/test/components/playlist/PlaylistCard.test.tsx +++ b/src/test/components/playlist/PlaylistCard.test.tsx @@ -67,6 +67,27 @@ describe("PlaylistCard", () => { expect(again.container.querySelector(".unread-dot")).toBeNull(); }); + test("privateBadgeOnly shows only the owner's private badge", () => { + const cases = [ + { isPublic: true, isOwner: true, shown: false }, + { isPublic: false, isOwner: false, shown: false }, + { isPublic: false, isOwner: true, shown: true }, + ]; + for (const { isPublic, isOwner, shown } of cases) { + const { container, unmount } = renderWithContexts( +
      + +
    , + ); + expect(container.querySelector(".playlist-badge") !== null).toBe(shown); + unmount(); + } + }); + test("delete doesn't open the playlist", async () => { const onDelete = vi.fn(); const user = userEvent.setup();