Skip to content

Reply to gif#1913

Merged
simo6529 merged 2 commits intomainfrom
reply-to-gif
Feb 9, 2026
Merged

Reply to gif#1913
simo6529 merged 2 commits intomainfrom
reply-to-gif

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Feb 9, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Wave drop reply previews now automatically detect and display embedded media URLs (GIFs and videos) as visual content instead of plain text.
  • Tests

    • Expanded test coverage for media URL parsing and content display handling, including query parameters and various media formats.

Signed-off-by: Simo <simo@6529.io>
Signed-off-by: Simo <simo@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

Adds a new parseStandaloneMediaUrl utility function to extract media URLs from text content, with corresponding unit tests. Integrates this utility into WaveDropReply to transform reply preview content when a single text segment contains a standalone media URL. Updates ContentDisplay tests to use onClick instead of onReplyClick.

Changes

Cohort / File(s) Summary
Test Updates
__tests__/components/waves/drops/ContentDisplay.test.tsx
Updated formatting with double quotes, changed prop assertions from onReplyClick to onClick, added test case for rendering with no text segments, and adjusted test descriptions and data formatting.
Media URL Parser Function
src/components/waves/drops/media-utils.ts, __tests__/components/waves/drops/media-utils.test.ts
Added new parseStandaloneMediaUrl function with regex-based URL validation and media type detection, plus constants for image/video extensions. Includes comprehensive unit tests covering GIF/MP4 URLs, query parameters, and invalid inputs.
Reply Content Transformation
components/waves/drops/WaveDropReply.tsx
Introduced useMemo hook to derive replyPreviewContent, which parses standalone media URLs from single text segments and transforms content structure when found, while preserving original content otherwise.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • Boosted wave preview #1727: Both modify the same components and utility files (ContentDisplay, WaveDropReply, and media-utils), addressing related content and media behavior updates.
  • Stabilize drop media #1908: Also modifies WaveDropReply.tsx and adjusts drop media/display behavior, including ContentDisplay prop changes.

Suggested reviewers

  • ragnep
  • GelatoGenesis

Poem

🐰 A rabbit hops through text so fine,
Finds hidden media in each line!
With regex magic, URLs bloom,
From lonely segments, clear the gloom!
ContentDisplay now dances free,
What media wonders shall they see? 📸

🚥 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 'Reply to gif' directly corresponds to the main feature: enabling users to reply with or to gifs by parsing standalone media URLs in reply content.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch reply-to-gif

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.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 9, 2026

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

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: 1

🤖 Fix all issues with AI agents
In `@components/waves/drops/media-utils.ts`:
- Around line 161-163: The Tenor host check in media-utils.ts is too narrow:
update the isGifHost logic that uses parsedUrl.hostname (currently checking host
=== "media.tenor.com") to accept all Tenor subdomains by using a endsWith check
(e.g., host.endsWith(".tenor.com")) similar to the existing .giphy.com pattern;
modify the isGifHost constant so it covers host.endsWith(".tenor.com") ||
host.endsWith(".giphy.com") (keeping parsedUrl and pathname usage unchanged).
🧹 Nitpick comments (1)
__tests__/components/waves/drops/media-utils.test.ts (1)

34-50: Tenor test doesn't isolate host-based detection from extension-based detection.

The Tenor URL https://media.tenor.com/abc/tenor.gif?itemid=1 has a .gif extension, so it would pass via the IMAGE_EXTENSIONS check even if the host check were removed. To truly validate the host-based branch, consider adding a test with a Tenor URL that doesn't have an image extension (e.g., https://media.tenor.com/abc/somefile).

Comment thread components/waves/drops/media-utils.ts
@simo6529 simo6529 merged commit 81c83ff into main Feb 9, 2026
7 checks passed
@simo6529 simo6529 deleted the reply-to-gif branch February 9, 2026 15:25
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