diff --git a/docs/moderation/fixtures/index.html b/docs/moderation/fixtures/index.html index c18e1f2a..e4e76db0 100644 --- a/docs/moderation/fixtures/index.html +++ b/docs/moderation/fixtures/index.html @@ -75,6 +75,7 @@ id: "1".repeat(64), title: "Fixture: Blurred Preview", pubkey: "a".repeat(64), + url: "https://example.com/video.mp4", thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg" }, moderation: { @@ -103,6 +104,7 @@ id: "2".repeat(64), title: "Fixture: Autoplay Blocked", pubkey: "e".repeat(64), + url: "https://example.com/video.mp4", thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg" }, moderation: { @@ -127,6 +129,7 @@ id: "3".repeat(64), title: "Fixture: Override Persistence", pubkey: "f".repeat(64), + url: "https://example.com/video.mp4", thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg" }, moderation: { @@ -152,6 +155,7 @@ id: "4".repeat(64), title: "Fixture: Trusted Report Hide", pubkey: "aa".repeat(32), + url: "https://example.com/video.mp4", thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg" }, moderation: { @@ -177,6 +181,7 @@ id: "5".repeat(64), title: "Fixture: Trusted Mute Hide", pubkey: "bb".repeat(32), + url: "https://example.com/video.mp4", thumbnail: "/assets/jpg/video-thumbnail-fallback.jpg" }, moderation: { @@ -607,6 +612,12 @@ } return true; }; + + card.onModerationHide = () => { + overrides = setOverride(overrides, video.id, { showAnyway: false }); + refreshModeration(); + return true; + }; } const root = card.getRoot(); diff --git a/js/ui/components/VideoCard.js b/js/ui/components/VideoCard.js index 4a68da36..342184ea 100644 --- a/js/ui/components/VideoCard.js +++ b/js/ui/components/VideoCard.js @@ -1856,9 +1856,9 @@ export class VideoCard { target.hidden = false; target.removeAttribute("hidden"); target.removeAttribute("aria-hidden"); - // If target is summary container, ensure it's displayed as block + // If target is summary container, ensure it's displayed as flex (to match bv-stack) if (target !== slot) { - target.style.setProperty("display", "block", "important"); + target.style.setProperty("display", "flex", "important"); } else { target.style.removeProperty("display"); } @@ -2009,7 +2009,7 @@ export class VideoCard { if (!this.hiddenSummaryEl) { this.hiddenSummaryEl = this.createElement("div", { - classNames: ["p-md", "bv-stack", "bv-stack--tight"], + classNames: ["p-md", "bv-stack", "bv-stack--tight", "items-start"], }); this.hiddenSummaryEl.dataset.moderationHiddenContainer = "true"; this.hiddenSummaryEl.setAttribute("role", "group"); diff --git a/tests/visual/moderation.spec.ts b/tests/visual/moderation.spec.ts index 945d04d8..8d384374 100644 --- a/tests/visual/moderation.spec.ts +++ b/tests/visual/moderation.spec.ts @@ -219,14 +219,11 @@ test.describe("moderation fixtures", () => { await expect(muteCard).toHaveAttribute("data-moderation-trusted-mute-count", "1"); await expect(badge).toContainText("Hidden ยท 1 trusted mute"); await expect(thumbnail).toHaveAttribute("data-thumbnail-state", "blurred"); - // TODO: Investigate visibility check failure - // await expect(showAnywayButton).toBeVisible(); + await expect(showAnywayButton).toBeVisible(); await expect(restoreButtonQuery).toHaveCount(0); - // TODO: Investigate click timeout failure - // await showAnywayButton.click({ force: true }); + await showAnywayButton.click(); - /* await expect(muteCard).not.toHaveAttribute("data-moderation-hidden", "true"); await expect(muteCard).toHaveAttribute("data-moderation-override", "show-anyway"); await expect(muteCard.locator('[data-moderation-badge="true"]')).toContainText( @@ -245,6 +242,5 @@ test.describe("moderation fixtures", () => { await expect(muteCard).not.toHaveAttribute("data-moderation-override", "show-anyway"); await expect(thumbnail).toHaveAttribute("data-thumbnail-state", "blurred"); await expect(muteCard.getByRole("button", { name: "Show anyway" })).toBeVisible(); - */ }); });