ui-common: Restore mention state when editing a message#6532
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Walkthrough
Mention State in Edit Mode
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/MessageComposerControllerTest.kt (1)
1738-1826: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a restored-session mention regression test.
These additions cover
performMessageAction(Edit)anddismissMessageActions(), but the newrestoreEditMode(...)path inMessageComposerControlleris the other changed entry point in this PR. A persisted-session case asserting mention restoration there would lock down the full behavior promised by the PR.🤖 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 `@stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/MessageComposerControllerTest.kt` around lines 1738 - 1826, Add a regression test for the restored-session edit flow by covering MessageComposerController.restoreEditMode(...), since the current tests only exercise performMessageAction(Edit) and dismissMessageActions(). Set up an edited message with mentions, restore the edit state from a persisted session, then build a new message and assert the expected mentions are preserved so the restore path matches the existing edit-mode behavior.
🤖 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.
Nitpick comments:
In
`@stream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/MessageComposerControllerTest.kt`:
- Around line 1738-1826: Add a regression test for the restored-session edit
flow by covering MessageComposerController.restoreEditMode(...), since the
current tests only exercise performMessageAction(Edit) and
dismissMessageActions(). Set up an edited message with mentions, restore the
edit state from a persisted session, then build a new message and assert the
expected mentions are preserved so the restore path matches the existing
edit-mode behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 5a4a7aad-b23a-4baa-bfa9-23b2c1869dc2
📒 Files selected for processing (2)
stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/MessageComposerController.ktstream-chat-android-ui-common/src/test/kotlin/io/getstream/chat/android/ui/common/feature/messages/composer/MessageComposerControllerTest.kt
0e09a78 to
ba1a545
Compare
ba1a545 to
0e09a78
Compare
|
|
🚀 Available in v7.5.0 |



Goal
Editing one mention in a message that has multiple mentions strips all of them. Entering edit mode never restored the composer's mention state, so
selectedMentionswas empty andfilterMentionsdropped every mention still present in the text on save.Reported during QA: Android QA - Mentions
Closes AND-1277
Implementation
MessageComposerControllernow rebuildsselectedMentionsfrom the message'smentionedUsers/mentionedChannel/mentionedHere/mentionedRoles/mentionedGroupswhen entering edit mode (both the action and the restored-session paths).selectedMentionsso restored mentions don't leak into the next message.Testing
MessageComposerControllerTestcases: removing one mention while editing keeps the others, an unchanged edit preserves mentions of every type, and dismissing an edit doesn't carry mentions into a fresh message.Summary by CodeRabbit
Bug Fixes
Tests