Skip to content

fix(embed): restore youtube thumbnails and file-row labels#1148

Merged
tomcasaburi merged 6 commits into
masterfrom
codex/fix/restore-youtube-embed-thumbnails
Jun 1, 2026
Merged

fix(embed): restore youtube thumbnails and file-row labels#1148
tomcasaburi merged 6 commits into
masterfrom
codex/fix/restore-youtube-embed-thumbnails

Conversation

@tomcasaburi
Copy link
Copy Markdown
Member

@tomcasaburi tomcasaburi commented Jun 1, 2026

Summary

  • Restore thumbnail-first YouTube embeds in post media and markdown hover previews (hover shows img.youtube.com thumb again, not an autoplaying iframe).
  • Centralize YouTube video ID parsing in embed-utils so thumbnails work for standard and Invidious-style URLs.
  • Desktop PostMedia shows File with the thumbnail image URL and type youtube video instead of Link + iframe.

Test plan

  • Post a thread with a YouTube link as the OP link: file row shows File, thumbnail URL, youtube video, thumbnail visible, click expands embed.
  • Hover a YouTube URL in post content (desktop): floating preview shows thumbnail, not iframe.
  • yarn test, yarn build, yarn lint, yarn type-check (run in CI)

Note

Low Risk
Mostly UI, media parsing, and i18n with broad test coverage; no auth or data-model changes.

Overview
This PR restores thumbnail-first YouTube handling in posts and link hovers, and tightens related parsing and UI copy.

YouTube embeds and mediagetYouTubeVideoId is centralized in embed-utils (watch, youtu.be, shorts, mobile/music hosts, Invidious). Embeds and media-utils use it for img.youtube.com thumbnails. Desktop PostMedia shows File, the thumbnail URL, and label youtube video instead of Link/iframe. Markdown floating link previews keep thumbnails (showThumbnail: true) instead of loading an iframe on hover.

Moderation / display — Removal, delete, and pending-mod reason text is rendered through markdown (no extra quotes); tests updated.

Board flags/int/ and /sp/ join /bant/ for auto geographic location without a visible flag selector; post/reply tests expanded.

P2P geo — IPv6 can be parsed from DNS6 hostnames with dash-encoded addresses (peer map flags in settings).

Minor: vitest --maxWorkers=4, youtube_video i18n, flash tag select styling.

Reviewed by Cursor Bugbot for commit effe16f. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Added YouTube video translation strings for all supported languages
    • YouTube ID extraction now supports many URL formats; floating comment media shows YouTube thumbnails
  • Bug Fixes

    • Improved display/formatting of comment removal and pending-approval reasons
  • Refactor

    • Centralized YouTube parsing for reuse
    • Auto-publish geographic location extended to additional boards
    • Enhanced IPv6 extraction for DNS6 relay addresses

Exclude the flash tag dropdown from themed post-form select styling so it
renders with the browser's default select appearance, matching the flag selector.
Extract embedded IPv6 addresses from dns6 multiaddrs so geo lookup and country flags work for relay peers that publish IPv6 via DNS hostnames.
Country-only boards auto-publish geographic location flags without
showing a flag dropdown, matching existing /bant/ behavior.
Restore thumbnail-first previews for YouTube embeds in post media and markdown hover.
Desktop posts show File with the thumbnail image URL and a youtube video type label.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
5chan Ready Ready Preview, Comment Jun 1, 2026 5:46am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 34726cfb-157b-44df-abc0-35c611069428

📥 Commits

Reviewing files that changed from the base of the PR and between 701790b and effe16f.

📒 Files selected for processing (40)
  • package.json
  • public/translations/ar/default.json
  • public/translations/bn/default.json
  • public/translations/cs/default.json
  • public/translations/da/default.json
  • public/translations/de/default.json
  • public/translations/el/default.json
  • public/translations/en/default.json
  • public/translations/es/default.json
  • public/translations/fa/default.json
  • public/translations/fi/default.json
  • public/translations/fil/default.json
  • public/translations/fr/default.json
  • public/translations/he/default.json
  • public/translations/hi/default.json
  • public/translations/hu/default.json
  • public/translations/id/default.json
  • public/translations/it/default.json
  • public/translations/ja/default.json
  • public/translations/ko/default.json
  • public/translations/mr/default.json
  • public/translations/nl/default.json
  • public/translations/no/default.json
  • public/translations/pl/default.json
  • public/translations/pt/default.json
  • public/translations/ro/default.json
  • public/translations/ru/default.json
  • public/translations/sq/default.json
  • public/translations/sv/default.json
  • public/translations/te/default.json
  • public/translations/th/default.json
  • public/translations/tr/default.json
  • public/translations/uk/default.json
  • public/translations/ur/default.json
  • public/translations/vi/default.json
  • public/translations/zh/default.json
  • src/components/__tests__/post-community-address-compat.test.tsx
  • src/components/embed/__tests__/embed.test.tsx
  • src/components/embed/embed-utils.ts
  • src/components/markdown/__tests__/markdown.test.tsx
✅ Files skipped from review due to trivial changes (15)
  • public/translations/vi/default.json
  • public/translations/nl/default.json
  • public/translations/da/default.json
  • public/translations/zh/default.json
  • public/translations/el/default.json
  • public/translations/ur/default.json
  • public/translations/mr/default.json
  • public/translations/no/default.json
  • public/translations/fa/default.json
  • public/translations/de/default.json
  • public/translations/it/default.json
  • public/translations/fi/default.json
  • public/translations/pl/default.json
  • public/translations/tr/default.json
  • public/translations/fil/default.json
🚧 Files skipped from review as they are similar to previous changes (20)
  • public/translations/ru/default.json
  • public/translations/ar/default.json
  • src/components/embed/tests/embed.test.tsx
  • public/translations/ja/default.json
  • public/translations/ro/default.json
  • public/translations/hu/default.json
  • public/translations/id/default.json
  • public/translations/uk/default.json
  • public/translations/en/default.json
  • src/components/markdown/tests/markdown.test.tsx
  • public/translations/bn/default.json
  • public/translations/sq/default.json
  • public/translations/te/default.json
  • public/translations/hi/default.json
  • src/components/embed/embed-utils.ts
  • public/translations/he/default.json
  • public/translations/fr/default.json
  • public/translations/th/default.json
  • public/translations/pt/default.json
  • public/translations/sv/default.json

📝 Walkthrough

Walkthrough

This PR centralizes YouTube video ID parsing, adds YouTube thumbnail/link helpers and floating-preview thumbnail behavior, expands auto-geographic-flag boards (bant → bant,int,sp), adds DNS6 embedded-IPv6 extraction for peer geolocation, refactors comment reason rendering, updates tests/mocks, and adds youtube_video translations across locales.

Changes

YouTube Media & Comment Improvements

Layer / File(s) Summary
YouTube video ID extraction helper
src/components/embed/embed-utils.ts, src/components/embed/__tests__/embed.test.tsx, src/components/embed/embed.tsx, src/components/embed/index.ts
New getYouTubeVideoId helper extracts video IDs from standard watch links, youtu.be, /shorts/, and Invidious-like hosts; YoutubeEmbed now delegates to it and the helper is re-exported with tests.
Media-utils & Post display
src/lib/utils/media-utils.ts, src/lib/utils/__tests__/media-utils.test.ts, src/components/post-desktop/post-desktop.tsx
Add getYouTubeEmbedPostMediaFileLink and getPostMediaTypeLabel, import shared ID helper, prefer YouTube file links/thumbnails in PostMedia rendering, and update tests/mocks.
Floating media preview & markdown tests
src/components/markdown/markdown.tsx, src/components/markdown/__tests__/markdown.test.tsx, src/components/comment-media/__tests__/comment-media.test.tsx
Test harness and component changes force thumbnail display for floating/non-mobile embeds, add mocks to simulate floating hover open/close, and add tests asserting YouTube thumbnail preview behavior (no iframe loaded on hover).
Moderation & pending reason rendering
src/components/comment-content/comment-content.tsx, src/components/comment-content/__tests__/comment-content.test.tsx
Refactor to derive reasonMessage/pendingApprovalReasonMessage and render formatted content via renderContent(...); tests updated to assert rendered markdown output.
Geographic auto-flag expansion
src/lib/comment-flag-selection.ts, src/lib/__tests__/comment-flag-selection.test.ts, src/components/post-form/__tests__/post-form.test.tsx, src/components/reply-modal/__tests__/reply-modal.test.tsx, src/components/post-form/post-form.tsx
Add int and sp to AUTO_GEOGRAPHIC_FLAG_DIRECTORY_CODES, update fixtures and parameterized tests, and add sports board test for post form behavior.
IPv6 extraction from DNS6 multiaddrs
src/lib/peer-geo.ts, src/lib/__tests__/peer-geo.test.ts, src/components/settings-modal/p2p-stats-settings/__tests__/p2p-stats-settings.test.tsx
Support extracting IPv6 encoded in /dns6/... hostnames (dash-separated hex → colon-form), validate candidates via URL parsing, and add tests for extraction and GeoIP fetch encoding.
Translations: youtube_video
public/translations/**/default.json (many locales)
Add youtube_video translation key adjacent to post_form_flash_upload_prompt across locale files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 I dug a tunnel through URL vines,

Found IDs where bright playback shines,
Thumbnails bob like carrots in view,
Flags bloom silent, two and then few,
IPv6 hops home — hooray, review!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main fix: restoring YouTube thumbnails and file-row labels in the embed system, which aligns with the comprehensive changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix/restore-youtube-embed-thumbnails

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread src/components/embed/embed-utils.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 19

🧹 Nitpick comments (4)
src/components/comment-content/comment-content.tsx (1)

230-236: 💤 Low value

Optional: Remove explicit null return.

The explicit null on line 236 can be omitted since the ternary expression without an else clause returns undefined implicitly, or you can remove the else branch entirely. Both are equivalent for React rendering.

♻️ Proposed simplification
-              {pendingApprovalReasonMessage ? (
+              {pendingApprovalReasonMessage && (
                 <>
                   <br />
                   <br />
                   {renderContent(pendingApprovalReasonMessage)}
                 </>
-              ) : null}
+              )}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/comment-content/comment-content.tsx` around lines 230 - 236,
The JSX fragment renders pendingApprovalReasonMessage with a ternary that
returns null in the else branch; simplify by removing the explicit null and
either use a short-circuit expression (pendingApprovalReasonMessage && (<><br
/><br />{renderContent(pendingApprovalReasonMessage)}</>)) or drop the else
branch so the ternary returns undefined implicitly—update the JSX around
pendingApprovalReasonMessage in the CommentContent component (where
renderContent is called) to remove the explicit null return.
src/components/comment-content/__tests__/comment-content.test.tsx (1)

69-71: 💤 Low value

Remove unused mock translation key.

The 'reason_reason' translation key mock is not used in any test case and can be removed for cleaner test setup.

♻️ Proposed cleanup
   useTranslation: () => ({
     t: (key: string, options?: Record<string, unknown>) => {
-      if (key === 'reason_reason') {
-        return `reason:${options?.reason}`;
-      }
       if (key === 'pending_mod_approval_reason') {
         return `pending-reason:${options?.reason}`;
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/comment-content/__tests__/comment-content.test.tsx` around
lines 69 - 71, Remove the unused mock translation key by deleting the
conditional branch that checks for "reason_reason" (the if (key ===
'reason_reason') { return `reason:${options?.reason}`; } block) from the test
i18n/mock translator in comment-content.test.tsx, and run the tests to confirm
nothing else depends on 'reason_reason'; if similar unused branches exist,
remove them as well to keep the mock translation function minimal.
src/components/markdown/markdown.tsx (1)

126-127: 💤 Low value

Floating embed behavior now forces thumbnails for all media types.

The change to showThumbnail={true} and setShowThumbnail={() => {}} prevents autoplay in floating hover previews, which makes sense for YouTube. However, this affects all embeddable media types (Streamable, etc.), not just YouTube. If this broader impact is intentional to improve hover preview UX across all media types, consider documenting this behavior change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/markdown/markdown.tsx` around lines 126 - 127, The change
forcing thumbnails by setting showThumbnail={true} and replacing
setShowThumbnail with a no-op causes all embeds to use static thumbnails
(preventing autoplay) rather than only YouTube; update the floating/embed logic
to conditionally enable thumbnail-only behavior for specific providers instead
of globally: locate the props passed (showThumbnail and setShowThumbnail) in the
Markdown embed/floating preview component (e.g., the component rendering embeds
or the FloatingEmbed wrapper) and change the boolean/no-op to be provider-aware
(check embed provider/type like "youtube" vs others) so only YouTube (or
configured providers) gets showThumbnail={true} and a disabled setShowThumbnail,
while other providers retain their original behavior or are configurable; add a
brief comment documenting this provider-specific decision.
src/components/post-form/post-form.tsx (1)

394-394: 💤 Low value

Consider moving styling change to separate commit.

The addition of className={styles.flagSelector} to the flash tag selector creates visual consistency with the flag selector, but this styling change is not mentioned in the layer description ("Auto-publish geographic location for additional boards") or PR objectives. While the change itself is fine, it appears to be outside the scope of this layer's stated purpose.

Consider whether this should be:

  • Documented in the PR description as an additional improvement
  • Split into a separate commit for clarity
  • Left as-is if it's needed for some non-obvious reason
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/post-form/post-form.tsx` at line 394, The change adds
className={styles.flagSelector} to the flash tag <select> in the PostForm
component (select name='flashTag', ref={flashTagRef}) which is unrelated to the
layer's stated purpose; either move this styling change into its own commit or
explicitly document it in the PR description as an additional UI
improvement—revert the className addition in this commit if you split it, or add
a note to the PR and keep the change if you choose to include it here.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@public/translations/ar/default.json`:
- Line 403: The translation key "youtube_video" is left as the English
placeholder in all non-English locale JSONs (ar, bn, cs, da, id, it, ja, ko);
update each locale's value for "youtube_video" to the correct target-language
string (e.g., Arabic: "فيديو يوتيوب", Bengali: "ইউটিউব ভিডিও", Czech: "video
youtube" or leave as-is, Danish: "youtube-video", Indonesian: "video youtube",
Italian: "video youtube", Japanese: "YouTubeビデオ" or "YouTube動画", Korean: "유튜브
동영상"), preserving JSON quoting and key names exactly and ensuring no trailing
commas or formatting errors.

In `@public/translations/de/default.json`:
- Line 403: The translation key "youtube_video" currently has an English value;
update its value in public/translations/de/default.json to a German localized
string such as "YouTube‑Video" (or "youtube‑video" if you prefer
lowercase/hyphenation) so the key youtube_video is properly translated into
German.

In `@public/translations/el/default.json`:
- Line 403: The translation for the key "youtube_video" is still in English;
update its value to a Greek translation such as "βίντεο YouTube" (or "βίντεο
youtube") by replacing "youtube video" with the Greek text for the
"youtube_video" key, and verify the phrasing with a native Greek speaker if
needed.

In `@public/translations/es/default.json`:
- Line 403: Update the translation value for the "youtube_video" key in the
Spanish translations JSON so it's localized (currently "youtube video"); replace
it with the Spanish string (e.g., "vídeo de youtube" or "video de youtube")
while keeping the JSON key intact and preserving proper quotes and punctuation.

In `@public/translations/fa/default.json`:
- Line 403: The translation key "youtube_video" in
public/translations/fa/default.json is left in English and should be localized;
replace the value "youtube video" with the Persian translation (e.g., "ویدئوی
یوتیوب" or "ویدیوی یوتیوب") so the UI label for youtube_video is displayed in
Persian; update the JSON value for the "youtube_video" key accordingly while
preserving JSON formatting.

In `@public/translations/mr/default.json`:
- Line 403: The translation key "youtube_video" currently contains the English
string "youtube video"; update its value in the Marathi translations file so it
is localized (for example set "youtube_video" to "youtube व्हिडिओ" or an
equivalent Marathi phrase), ensuring the JSON string is properly quoted and
escaped if needed and matches the style of other entries in the file.

In `@public/translations/nl/default.json`:
- Line 403: The translation for the key "youtube_video" is still in English;
update its value in the JSON (key "youtube_video") to a Dutch translation such
as "youtube-video" (or "youtube video" if you prefer spacing) so the
nl/default.json entry is localized to Dutch.

In `@public/translations/no/default.json`:
- Line 403: The translation for the key "youtube_video" is currently in English;
update the value for the "youtube_video" key in the Norwegian translations file
to an appropriate Norwegian string (e.g., "youtube-video" or another
Norwegian-localized equivalent) so the key is properly localized in the file.

In `@public/translations/pl/default.json`:
- Line 403: The key "youtube_video" in the Polish translations is still English;
update its value under "youtube_video" in public/translations/pl/default.json to
a proper Polish translation such as "wideo YouTube" or "film YouTube" (matching
project capitalization/term conventions) so Polish users see a localized label.

In `@public/translations/pt/default.json`:
- Line 403: The translation key "youtube_video" currently has an English value
("youtube video"); update its value in the Portuguese locale to a proper
Portuguese phrase such as "vídeo do YouTube" (or "vídeo YouTube"/"vídeo do
youtube" if you prefer lowercase branding) by replacing the value for the
"youtube_video" key in public/translations/pt/default.json so Portuguese users
see the translated string.

In `@public/translations/ro/default.json`:
- Line 403: The translation for the key "youtube_video" is still in English;
update the value for the "youtube_video" entry in
public/translations/ro/default.json to a Romanian translation such as "video
YouTube" (or "video youtube") so Romanian users see the localized text for the
youtube_video key.

In `@public/translations/ru/default.json`:
- Line 403: The translation for the key "youtube_video" is still in English;
update the value for "youtube_video" in the locale JSON to an appropriate
Russian translation (e.g., "видео YouTube" or "видео youtube") so Russian users
see localized text, preserving the JSON string format and surrounding quotes.

In `@public/translations/sq/default.json`:
- Line 403: The translation key "youtube_video" in
public/translations/sq/default.json currently has an English value ("youtube
video"); update its value to the correct Albanian translation (for example
"video YouTube" or "video në YouTube") so the Albanian locale displays the
proper localized string — modify the JSON entry for "youtube_video" accordingly.

In `@public/translations/sv/default.json`:
- Line 403: The translation key "youtube_video" currently has an English value
("youtube video") in the Swedish locale; update the value to a proper Swedish
translation (e.g., "youtube-video" or another preferred Swedish phrasing) by
replacing the string for the "youtube_video" key in the JSON (key:
"youtube_video") so Swedish users see the correct localized text.

In `@public/translations/te/default.json`:
- Line 403: The translation for the key "youtube_video" in
public/translations/te/default.json is currently in English ("youtube video");
update the value to Telugu by replacing the string for the "youtube_video" key
with the appropriate Telugu translation (e.g., "యూట్యూబ్ వీడియో") so the Telugu
locale shows localized text.

In `@public/translations/th/default.json`:
- Line 403: The "youtube_video" localization entry currently contains English
text; update the value for the "youtube_video" key to the Thai translation (for
example "วิดีโอ YouTube") in the JSON so the Thai locale shows proper localized
text, preserving the JSON string quoting and UTF-8 encoding and keeping the key
name "youtube_video" unchanged.

In `@public/translations/tr/default.json`:
- Line 403: The "youtube_video" translation key currently contains English text;
update its value to the Turkish translation by replacing "youtube video" with
"youtube videosu" in the translations JSON so the "youtube_video" key returns
the correct localized string.

In `@public/translations/uk/default.json`:
- Line 403: Replace the English value for the i18n key "youtube_video" in the
translations JSON so the Ukrainian localization is used; update the entry for
"youtube_video" from "youtube video" to the correct Ukrainian string (e.g.,
"youtube відео") in the translations object to maintain i18n consistency.

In `@public/translations/ur/default.json`:
- Line 403: The translation for the key "youtube_video" in
public/translations/ur/default.json is still in English; replace the value
"youtube video" with the correct Urdu localization (for example "یوٹیوب ویڈیو")
so the "youtube_video" key returns Urdu text for Urdu users.

---

Nitpick comments:
In `@src/components/comment-content/__tests__/comment-content.test.tsx`:
- Around line 69-71: Remove the unused mock translation key by deleting the
conditional branch that checks for "reason_reason" (the if (key ===
'reason_reason') { return `reason:${options?.reason}`; } block) from the test
i18n/mock translator in comment-content.test.tsx, and run the tests to confirm
nothing else depends on 'reason_reason'; if similar unused branches exist,
remove them as well to keep the mock translation function minimal.

In `@src/components/comment-content/comment-content.tsx`:
- Around line 230-236: The JSX fragment renders pendingApprovalReasonMessage
with a ternary that returns null in the else branch; simplify by removing the
explicit null and either use a short-circuit expression
(pendingApprovalReasonMessage && (<><br /><br
/>{renderContent(pendingApprovalReasonMessage)}</>)) or drop the else branch so
the ternary returns undefined implicitly—update the JSX around
pendingApprovalReasonMessage in the CommentContent component (where
renderContent is called) to remove the explicit null return.

In `@src/components/markdown/markdown.tsx`:
- Around line 126-127: The change forcing thumbnails by setting
showThumbnail={true} and replacing setShowThumbnail with a no-op causes all
embeds to use static thumbnails (preventing autoplay) rather than only YouTube;
update the floating/embed logic to conditionally enable thumbnail-only behavior
for specific providers instead of globally: locate the props passed
(showThumbnail and setShowThumbnail) in the Markdown embed/floating preview
component (e.g., the component rendering embeds or the FloatingEmbed wrapper)
and change the boolean/no-op to be provider-aware (check embed provider/type
like "youtube" vs others) so only YouTube (or configured providers) gets
showThumbnail={true} and a disabled setShowThumbnail, while other providers
retain their original behavior or are configurable; add a brief comment
documenting this provider-specific decision.

In `@src/components/post-form/post-form.tsx`:
- Line 394: The change adds className={styles.flagSelector} to the flash tag
<select> in the PostForm component (select name='flashTag', ref={flashTagRef})
which is unrelated to the layer's stated purpose; either move this styling
change into its own commit or explicitly document it in the PR description as an
additional UI improvement—revert the className addition in this commit if you
split it, or add a note to the PR and keep the change if you choose to include
it here.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 101f575b-0d18-4180-bd15-a420fe79a509

📥 Commits

Reviewing files that changed from the base of the PR and between d48cf10 and 701790b.

📒 Files selected for processing (55)
  • public/translations/ar/default.json
  • public/translations/bn/default.json
  • public/translations/cs/default.json
  • public/translations/da/default.json
  • public/translations/de/default.json
  • public/translations/el/default.json
  • public/translations/en/default.json
  • public/translations/es/default.json
  • public/translations/fa/default.json
  • public/translations/fi/default.json
  • public/translations/fil/default.json
  • public/translations/fr/default.json
  • public/translations/he/default.json
  • public/translations/hi/default.json
  • public/translations/hu/default.json
  • public/translations/id/default.json
  • public/translations/it/default.json
  • public/translations/ja/default.json
  • public/translations/ko/default.json
  • public/translations/mr/default.json
  • public/translations/nl/default.json
  • public/translations/no/default.json
  • public/translations/pl/default.json
  • public/translations/pt/default.json
  • public/translations/ro/default.json
  • public/translations/ru/default.json
  • public/translations/sq/default.json
  • public/translations/sv/default.json
  • public/translations/te/default.json
  • public/translations/th/default.json
  • public/translations/tr/default.json
  • public/translations/uk/default.json
  • public/translations/ur/default.json
  • public/translations/vi/default.json
  • public/translations/zh/default.json
  • src/components/comment-content/__tests__/comment-content.test.tsx
  • src/components/comment-content/comment-content.tsx
  • src/components/comment-media/__tests__/comment-media.test.tsx
  • src/components/embed/__tests__/embed.test.tsx
  • src/components/embed/embed-utils.ts
  • src/components/embed/embed.tsx
  • src/components/embed/index.ts
  • src/components/markdown/__tests__/markdown.test.tsx
  • src/components/markdown/markdown.tsx
  • src/components/post-desktop/post-desktop.tsx
  • src/components/post-form/__tests__/post-form.test.tsx
  • src/components/post-form/post-form.tsx
  • src/components/reply-modal/__tests__/reply-modal.test.tsx
  • src/components/settings-modal/p2p-stats-settings/__tests__/p2p-stats-settings.test.tsx
  • src/lib/__tests__/comment-flag-selection.test.ts
  • src/lib/__tests__/peer-geo.test.ts
  • src/lib/comment-flag-selection.ts
  • src/lib/peer-geo.ts
  • src/lib/utils/__tests__/media-utils.test.ts
  • src/lib/utils/media-utils.ts

Comment thread public/translations/ar/default.json Outdated
Comment thread public/translations/de/default.json Outdated
Comment thread public/translations/el/default.json Outdated
Comment thread public/translations/es/default.json Outdated
Comment thread public/translations/fa/default.json Outdated
Comment thread public/translations/te/default.json Outdated
Comment thread public/translations/th/default.json Outdated
Comment thread public/translations/tr/default.json Outdated
Comment thread public/translations/uk/default.json Outdated
Comment thread public/translations/ur/default.json Outdated
Translate the youtube video label, handle mobile/music YouTube hosts as standard YouTube URLs, keep affected mocks current, and cap default Vitest workers to reduce local CPU spikes.
@tomcasaburi
Copy link
Copy Markdown
Member Author

Addressed the valid review feedback in effe16f.

Fixed:

  • Treated m.youtube.com and music.youtube.com as standard YouTube hosts so channel/user paths are not mistaken for Invidious-style video ids.
  • Updated the affected test mock exports so the full test suite can load current media utilities.
  • Translated youtube_video across all supported locales using the repo translation workflow, preserving the YouTube brand.
  • Capped the default Vitest worker count with vitest --maxWorkers=4 to keep local test runs from spawning too many Node workers.

Triaged as non-blocking:

  • Floating hover previews remain thumbnail-only for media that already exposes a thumbnail. In this PR, the special file-row label/link behavior remains YouTube-only; existing deterministic embed thumbnail providers are only YouTube and Streamable.
  • The remaining CodeRabbit notes are low-value style/scope comments and do not block merge.

Local verification run: yarn build, yarn lint, yarn type-check, yarn test --run, yarn doctor, yarn knip, targeted embed/media tests, translation audit dry run, and Playwright browser checks across Chromium, Firefox, and WebKit on desktop and mobile.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit effe16f. Configure here.

const mediaDimensions = getMediaDimensions(commentMediaInfo);
const directoryEntry = findDirectoryByAddress(directories, communityAddress);
const requirePostLinkIsMedia = directoryEntry?.features?.requirePostLinkIsMedia === true;
const fileLabel = youtubeFileLink || requirePostLinkIsMedia ? t('file') : t('link');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong file row label

Medium Severity

For YouTube OP links, the file row prefix is the thumbnail URL string instead of the translated “File” label, because fileLabel is parsed as youtubeFileLink || (requirePostLinkIsMedia ? … : …) rather than grouping the two conditions before the ternary.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit effe16f. Configure here.

@tomcasaburi tomcasaburi merged commit 829b672 into master Jun 1, 2026
11 checks passed
@tomcasaburi tomcasaburi deleted the codex/fix/restore-youtube-embed-thumbnails branch June 1, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant