Skip to content

Fix ChannelAvatar not using UserAvatar from ComponentFactory#6407

Open
VelikovPetar wants to merge 1 commit intodevelopfrom
bug/AND-1167_fix_channel_avatar_not_using_avatar_from_factory
Open

Fix ChannelAvatar not using UserAvatar from ComponentFactory#6407
VelikovPetar wants to merge 1 commit intodevelopfrom
bug/AND-1167_fix_channel_avatar_not_using_avatar_from_factory

Conversation

@VelikovPetar
Copy link
Copy Markdown
Contributor

@VelikovPetar VelikovPetar commented May 1, 2026

Goal

ChannelAvatar was rendering its inner user avatars by calling UserAvatar directly instead of going through ChatTheme.componentFactory.UserAvatar. This meant integrators who customised UserAvatar via the component factory saw their override ignored when the avatar was shown inside a channel avatar (DM and stacked group variants).

Closes AND-1167.

Implementation

Replaced direct UserAvatar(...) calls in ChannelAvatar.kt with ChatTheme.componentFactory.UserAvatar(params = UserAvatarParams(...)) in all three sites:

  • DM recipient avatar
  • Single-member stacked group avatar
  • Multi-member stacked group avatars

This routes the rendering through the configured component factory so factory overrides are respected.

UI Changes

No UI changes by default. Integrators who provide a custom UserAvatar via ChatTheme.componentFactory will now see their override applied inside ChannelAvatar.

Testing

  • Build & run the Compose sample app and verify channel avatars (DM and group) still render correctly.
  • Provide a custom ComponentFactory that overrides UserAvatar and confirm the override is now used by channel avatars.

Summary by CodeRabbit

  • Refactor
    • Improved avatar rendering architecture in the channel avatar component for enhanced theme consistency.

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

github-actions Bot commented May 1, 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.

@VelikovPetar VelikovPetar changed the title Fix ChannelAvatar not using UserAvatar from ComponentFactory Fix ChannelAvatar not using UserAvatar from ComponentFactory May 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.82 MB 5.82 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.02 MB 11.02 MB 0.00 MB 🟢
stream-chat-android-compose 12.37 MB 12.37 MB 0.00 MB 🟢

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

@VelikovPetar VelikovPetar marked this pull request as ready for review May 1, 2026 09:31
@VelikovPetar VelikovPetar requested a review from a team as a code owner May 1, 2026 09:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5381737b-6018-44f5-9594-7b938a6d6a02

📥 Commits

Reviewing files that changed from the base of the PR and between c823b08 and 97622f1.

📒 Files selected for processing (1)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/ChannelAvatar.kt

Walkthrough

The ChannelAvatar component is refactored to render user avatars through the theme's component factory instead of direct instantiation. Avatar parameters are now packaged into UserAvatarParams objects and forwarded to the factory method across multiple rendering locations.

Changes

Cohort / File(s) Summary
Avatar Factory Refactoring
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/ChannelAvatar.kt
Replaced direct UserAvatar calls with ChatTheme.componentFactory.UserAvatar invocations. Parameters (modifier, user, showBorder, showIndicator) are now packaged into UserAvatarParams before being passed to the factory. Changes applied across direct-message recipient rendering and stacked group avatar tiers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Avatars dance through factory halls,
No direct calls, just themed walls,
Parameters bundled with careful care,
UserAvatarParams floating in air!
Refactored smooth as a rabbit's hop,
The compose flows never shall stop! 🎨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing ChannelAvatar to use UserAvatar from ComponentFactory instead of instantiating it directly.
Description check ✅ Passed The description covers Goal, Implementation, UI Changes, and Testing sections as required by the template, though some optional sections like screenshots and checklists are incomplete.
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 bug/AND-1167_fix_channel_avatar_not_using_avatar_from_factory

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

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.

1 participant