Skip to content

Hide link preview for internal links #1778

Merged
prxt6529 merged 3 commits intomainfrom
hide-link-preview-all-links
Jan 21, 2026
Merged

Hide link preview for internal links #1778
prxt6529 merged 3 commits intomainfrom
hide-link-preview-all-links

Conversation

@prxt6529
Copy link
Copy Markdown
Collaborator

@prxt6529 prxt6529 commented Jan 21, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Link preview setting now fully disables previews at the link level, ensuring plain anchors are shown (no open-graph or rich previews) when the setting is enabled.
  • Tests

    • Added tests verifying that link previews (including YouTube) are not rendered when the preview setting is turned off.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: prxt6529 <prxt@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Short-circuited link preview rendering: renderAnchor now returns a fallback anchor when hideLinkPreviews is true, bypassing Open Graph/YT preview paths; isSmartLink still disables smart-link behavior when previews are hidden. Tests added to assert YouTube previews are suppressed under the flag.

Changes

Cohort / File(s) Summary
Link preview logic
components/drops/view/part/dropPartMarkdown/linkHandlers.tsx
Added early guard in renderAnchor to return a fallback anchor when hideLinkPreviews is true; removed redundant guard from renderOpenGraph; retained isSmartLink guard to disable smart-link behavior.
Tests verifying behavior
__tests__/components/drops/view/part/dropPartMarkdown/linkHandlersRegistry.test.tsx
Added tests asserting that with hideLinkPreviews: true, YouTube previews are not rendered and a plain anchor is used instead (checks absence of youtube-preview test ID and presence of anchor href).

Sequence Diagram(s)

(Skipped — change is localized and testing-focused; diagram not required.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • drop preview url fix #1556: Modifies the same linkHandlers.tsx rendering flow (href handling / stable link logic) and may interact with the new hideLinkPreviews short-circuit.

Suggested reviewers

  • ragnep
  • simo6529

Poem

🐰 I nudge the link, then hop away,

No preview blooms to steal the day,
Anchors stand simple, tidy, true,
Smart-links nap while I chew glue,
A quiet patch — a rabbit's cue. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Hide link preview for internal links' is partially related to the changeset. The code changes implement hiding link previews when hideLinkPreviews is true, but the title specifically mentions 'internal links' while the implementation appears to be a general feature flag affecting all link preview rendering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

simo6529
simo6529 previously approved these changes Jan 21, 2026
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

@prxt6529 prxt6529 merged commit 18e1dc6 into main Jan 21, 2026
6 of 7 checks passed
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.

2 participants