Skip to content

fix(ui): Fix shadowed messages not hidden in the channel list#2787

Open
VelikovPetar wants to merge 4 commits into
masterfrom
bug/FLU-562_fix_shadowed_messages_appearing_in_channel_list
Open

fix(ui): Fix shadowed messages not hidden in the channel list#2787
VelikovPetar wants to merge 4 commits into
masterfrom
bug/FLU-562_fix_shadowed_messages_appearing_in_channel_list

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-562

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

We were correctly hiding shadowed messages from other users in the Message List, but not on the Channel List items. This PR enhances the ChannelLastMessageText predicate with checks for shadowed messages from other users.

Screenshots / Videos

Before After
shadowed-before.mov
shadowed-after.mov

Summary by CodeRabbit

  • Bug Fixes
    • Fixed channel list message previews so shadowed messages are no longer hidden incorrectly.
    • Shadowed messages are excluded only when they’re not authored by the current user (while still excluding error and ephemeral messages).
  • New Features
    • Added an optional last-message predicate to control which message is shown in channel list previews.
  • Tests
    • Added widget tests covering current-user shadowed behavior, error/ephemeral filtering, and predicate overrides.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 480091e9-0bec-4606-bee4-5e0c57ad7975

📥 Commits

Reviewing files that changed from the base of the PR and between 5a73c59 and 74f5622.

📒 Files selected for processing (2)
  • packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_item.dart
  • packages/stream_chat_flutter/test/src/scroll_view/channel_scroll_view/stream_channel_list_item_test.dart
💤 Files with no reviewable changes (1)
  • packages/stream_chat_flutter/test/src/scroll_view/channel_scroll_view/stream_channel_list_item_test.dart
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_item.dart

📝 Walkthrough

Walkthrough

Channel list last-message rendering now distinguishes shadowed messages by current user, exposes an optional predicate override, and adds widget tests for the updated visibility rules.

Changes

Shadowed channel list messages

Layer / File(s) Summary
Filter logic and wiring
packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_item.dart, packages/stream_chat_flutter/CHANGELOG.md
ChannelLastMessageText now builds its default predicate from currentUserId, accepts an optional lastMessagePredicate, and allows shadowed messages from the current user while keeping the existing hidden-message exclusions.
Widget coverage
packages/stream_chat_flutter/test/src/scroll_view/channel_scroll_view/stream_channel_list_item_test.dart
Widget tests stub client and channel state, then cover visible, shadowed, error, ephemeral, and custom-predicate rendering cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A bunny hopped by with a twitchy nose,
To see shadowed messages bloom in rows.
One ear for tests, one ear for code,
Now hidden notes take a clearer road. 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main fix: correcting shadowed messages in channel list items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/FLU-562_fix_shadowed_messages_appearing_in_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.

@VelikovPetar VelikovPetar marked this pull request as ready for review June 25, 2026 18:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_item.dart (1)

587-595: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the default last-message filter into one shared helper.

The same current-user-aware shadow/error/ephemeral filtering now lives in both _ChannelLastMessageWithStatusState and ChannelLastMessageText. That makes it easy for these two channel-list paths to drift again on the next visibility-rule change. Have both call one private helper/factory instead.

Also applies to: 704-712

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_item.dart`
around lines 587 - 595, The default last-message visibility logic is duplicated
between _defaultLastMessagePredicate in _ChannelLastMessageWithStatusState and
the matching filter used by ChannelLastMessageText, so move the
current-user-aware shadow/error/ephemeral checks into one shared private
helper/factory and have both call it. Keep the existing behavior by reusing the
same Message-based predicate logic (including currentUser, shadowed/isShadowed,
isError, and isEphemeral) from both channel-list paths so they cannot drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/stream_chat_flutter/test/src/scroll_view/channel_scroll_view/stream_channel_list_item_test.dart`:
- Line 6: The import in stream_channel_list_item_test.dart uses a relative path
and violates the always_use_package_imports rule. Update the import currently
referencing mocks.dart through a relative URI to use the package import style
instead, keeping the same dependency but matching the rest of the codebase and
the analysis configuration.

---

Nitpick comments:
In
`@packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_item.dart`:
- Around line 587-595: The default last-message visibility logic is duplicated
between _defaultLastMessagePredicate in _ChannelLastMessageWithStatusState and
the matching filter used by ChannelLastMessageText, so move the
current-user-aware shadow/error/ephemeral checks into one shared private
helper/factory and have both call it. Keep the existing behavior by reusing the
same Message-based predicate logic (including currentUser, shadowed/isShadowed,
isError, and isEphemeral) from both channel-list paths so they cannot drift.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08d6a979-2e53-4e01-b2d0-3f8179330577

📥 Commits

Reviewing files that changed from the base of the PR and between eb0a0ec and 8b29103.

📒 Files selected for processing (3)
  • packages/stream_chat_flutter/CHANGELOG.md
  • packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_item.dart
  • packages/stream_chat_flutter/test/src/scroll_view/channel_scroll_view/stream_channel_list_item_test.dart

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.69%. Comparing base (eb0a0ec) to head (74f5622).

Files with missing lines Patch % Lines
.../channel_scroll_view/stream_channel_list_item.dart 77.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2787      +/-   ##
==========================================
+ Coverage   69.59%   69.69%   +0.10%     
==========================================
  Files         426      426              
  Lines       25676    25676              
==========================================
+ Hits        17869    17896      +27     
+ Misses       7807     7780      -27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant