Skip to content

Show Giphy preview in channel list message previews#6310

Merged
VelikovPetar merged 2 commits intov7from
bug/fix_giphy_preview_channel_list
Mar 31, 2026
Merged

Show Giphy preview in channel list message previews#6310
VelikovPetar merged 2 commits intov7from
bug/fix_giphy_preview_channel_list

Conversation

@VelikovPetar
Copy link
Copy Markdown
Contributor

@VelikovPetar VelikovPetar commented Mar 30, 2026

Goal

Giphy messages in the channel list were considered as links. This brings Giphy in line with how photos, videos, files, and other attachment types are displayed.

Implementation

  • Add AttachmentType.GIPHY classification in DefaultMessagePreviewFormatter.appendTypedAttachmentPreview() with icon + "Giphy" label
  • Add GIPHY constant and inline icon entry in DefaultMessagePreviewIconFactory using a new stream_compose_ic_giphy drawable
  • Add stream_compose_ic_giphy.xml vector drawable (12dp document-style icon)
  • Add stream_compose_giphy_preview string resource

UI Changes

Before After
giphy_preview_before.mp4
giphy_preview_after.mp4

Testing

  • Send a Giphy message in a channel and verify the channel list shows the Giphy icon + "Giphy" label
  • Verify other attachment type previews (photo, video, file, link, poll, voice, location) are unaffected

Summary by CodeRabbit

Release Notes

  • New Features
    • Added GIPHY attachment preview support in messages—GIPHY attachments now display with a dedicated icon and preview label for improved content visibility.

Co-Authored-By: Claude <noreply@anthropic.com>
@VelikovPetar VelikovPetar added the pr:bug Bug fix label Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Walkthrough

These changes add GIPHY attachment support to the message preview system. A new GIPHY icon drawable and localized string resource are introduced, along with logic to detect GIPHY attachments and render them with the corresponding icon and label in message previews.

Changes

Cohort / File(s) Summary
Message Preview Logic
MessagePreviewFormatter.kt, MessagePreviewIconFactory.kt
Added GIPHY attachment detection and rendering in preview formatter, and mapped GIPHY message type to a tinted icon in the icon factory.
UI Resources
stream_compose_ic_giphy.xml, strings.xml
Added new GIPHY icon vector drawable (12×12dp stroked path) and localized string resource label.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A GIPHY bounces into the chat,
With icons tinted just like that,
Now previews dance with animated grace,
The little rabbit grins with delight in this place! 🎬✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: showing Giphy preview in channel list message previews, matching the primary objective of the changeset.
Description check ✅ Passed The description covers the required sections (Goal, Implementation, UI Changes, Testing) with good detail. Goal explains why the change is needed, Implementation details all modified files, UI Changes include before/after videos, and Testing provides concrete steps. Contributor and Reviewer checklists are not completed, but the core content is comprehensive.

✏️ 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 bug/fix_giphy_preview_channel_list

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.68 MB 0.43 MB 🟡
stream-chat-android-ui-components 10.60 MB 10.99 MB 0.39 MB 🟡
stream-chat-android-compose 12.81 MB 12.13 MB -0.68 MB 🚀

@VelikovPetar VelikovPetar marked this pull request as ready for review March 30, 2026 12:36
@VelikovPetar VelikovPetar requested a review from a team as a code owner March 30, 2026 12:36
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.

🧹 Nitpick comments (1)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/MessagePreviewFormatter.kt (1)

294-298: Add a regression test for GIPHY-vs-link precedence.

The new branch ordering is correct, but this is easy to regress later. Please add coverage ensuring GIPHY attachments render the Giphy preview (icon + label) even when link fields are also present.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/MessagePreviewFormatter.kt`
around lines 294 - 298, Add a regression unit test that verifies GIPHY
attachments take precedence over link previews: in the MessagePreviewFormatter
tests (e.g., MessagePreviewFormatterTest) create a message/Attachment with giphy
fields set (so giphy.isNotEmpty() triggers) and also include link metadata
fields, invoke the formatter method that builds the preview (the code path
containing appendInlineContent(DefaultMessagePreviewIconFactory.GIPHY) /
append(context.getString(R.string.stream_compose_giphy_preview))) and assert the
resulting preview contains the GIPHY icon/label and does not render the link
preview text; if there’s no existing test helper, mock or build the
Attachment/Message models used by formatPreview to reproduce this branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/MessagePreviewFormatter.kt`:
- Around line 294-298: Add a regression unit test that verifies GIPHY
attachments take precedence over link previews: in the MessagePreviewFormatter
tests (e.g., MessagePreviewFormatterTest) create a message/Attachment with giphy
fields set (so giphy.isNotEmpty() triggers) and also include link metadata
fields, invoke the formatter method that builds the preview (the code path
containing appendInlineContent(DefaultMessagePreviewIconFactory.GIPHY) /
append(context.getString(R.string.stream_compose_giphy_preview))) and assert the
resulting preview contains the GIPHY icon/label and does not render the link
preview text; if there’s no existing test helper, mock or build the
Attachment/Message models used by formatPreview to reproduce this branch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fe9d841e-e91d-4c0c-81e2-0c60e4fcb820

📥 Commits

Reviewing files that changed from the base of the PR and between 0a6ceb0 and 2a3058e.

📒 Files selected for processing (4)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/MessagePreviewFormatter.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/util/MessagePreviewIconFactory.kt
  • stream-chat-android-compose/src/main/res/drawable/stream_compose_ic_giphy.xml
  • stream-chat-android-compose/src/main/res/values/strings.xml

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
29.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@VelikovPetar VelikovPetar merged commit 51e3ab0 into v7 Mar 31, 2026
19 of 21 checks passed
@VelikovPetar VelikovPetar deleted the bug/fix_giphy_preview_channel_list branch March 31, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants