Skip to content

Conversation

@VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Dec 24, 2025

🎯 Goal

Incoming messages from muted users don't increase the unread count server-side, so we shouldn't increase it client-side as well.

🛠 Implementation details

Add guard in ChannelStateLogic.updateCurrentUserRead preventing the unread count from increasing for messages from muted users.

🎨 UI Changes

Before After
muted_before.mov
muted_after.mov

🧪 Testing

  1. Open channel list with user A (ex. Petar Velikov)
  2. From a different device, send a message from a user muted by user A (ex. Lando Calrissian)
  3. User A should not have its unread count increased by the messages from the current user
  4. Verify this is correct by logging in and out - refreshing the channel list would give you the correct unread count from the server

Summary by CodeRabbit

  • Bug Fixes

    • Unread counts no longer increase when messages come from users you’ve muted. Muted users’ messages are excluded from unread calculations so channel indicators remain accurate.
  • Tests

    • Added a test to verify muted users’ messages do not update unread counts.

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 24, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.25 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.60 MB 10.60 MB 0.00 MB 🟢
stream-chat-android-compose 12.81 MB 12.81 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar marked this pull request as ready for review December 25, 2025 04:31
@VelikovPetar VelikovPetar requested a review from a team as a code owner December 25, 2025 04:31
@coderabbitai
Copy link

coderabbitai bot commented Dec 25, 2025

Walkthrough

Added a guard in channel read-update logic to ignore messages authored by globally muted users and a test plus changelog entry to prevent such messages from increasing channel unread counts.

Changes

Cohort / File(s) Summary
Changelog
CHANGELOG.md
Added entry documenting the fix: messages from muted users no longer increment unread counts.
Channel state logic
stream-chat-android-state/src/main/java/io/getstream/chat/android/state/plugin/logic/channel/internal/ChannelStateLogic.kt
Added an early-return guard in updateCurrentUserRead that checks global mute state and marks messages from muted users as processed to avoid updating reads/unread counts.
Tests
stream-chat-android-state/src/test/java/io/getstream/chat/android/state/plugin/logic/channel/internal/ChannelStateLogicTest.kt
Added test verifying updateCurrentUserRead does not call mutableState.upsertReads for messages from a globally muted user.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • testableapple

Poem

🐰 A gentle hush across the stream,
Muted hops skip the unread dream,
Counts stay calm, no noisy spike,
Quiet carrots, code done right 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing unread count behavior for muted users.
Description check ✅ Passed The description covers goal, implementation details, UI changes with videos, and comprehensive testing steps, though some optional sections like checklist items are not marked.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/AND-989_fix_messages_from_muted_user_increasing_unread_count

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4e66a2a and cb6ce7e.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: API check
  • GitHub Check: Debug build
  • GitHub Check: Unit tests
  • GitHub Check: compare-sdk-sizes / Compare SDK sizes
  • GitHub Check: Build / compose apks

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

@VelikovPetar VelikovPetar merged commit 0a6844e into develop Dec 29, 2025
13 checks passed
@VelikovPetar VelikovPetar deleted the bug/AND-989_fix_messages_from_muted_user_increasing_unread_count branch December 29, 2025 10:34
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.

3 participants