-
Notifications
You must be signed in to change notification settings - Fork 367
fix(ui): enable sending reply in threads for users with sendReply capability #2385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v10.0.0
Are you sure you want to change the base?
Conversation
…ability This commit allows users with the `sendReply` capability to send replies within a thread, even if they don't have broader send message permission.
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdds thread-aware permission checks to message input so users with sendReply can reply in threads even without sendMessage. Updates the changelog to note the fix. No public API changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as MessageInput UI
participant Perm as Capability Check
participant Chan as Channel (capabilities)
User->>UI: Focus thread reply input
UI->>Perm: canSendOrUpdateMessage(message)
Perm->>Perm: insideThread = message.parentId != null
Perm->>Chan: get capabilities
alt insideThread
Note over Perm: Include sendReply in check
else not in thread
Note over Perm: Check sendMessage only
end
Perm-->>UI: allowed / denied
alt allowed
UI->>Chan: send reply message
Chan-->>UI: ack
else denied
UI-->>User: input disabled / no permission
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
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 |
@coderabbitai review |
✅ Actions performedReview triggered.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v10.0.0 #2385 +/- ##
==========================================
Coverage ? 64.93%
==========================================
Files ? 419
Lines ? 25944
Branches ? 0
==========================================
Hits ? 16846
Misses ? 9098
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart (1)
620-634
: Fix edit gating: require update rights for stored edits; follow send rights for composing/bounced edits.File: packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart — canSendOrUpdateMessage
Current OR logic lets thread sendReply enable the edit UI for stored messages without update permissions; split edit vs send logic and treat bounced-with-error edits as sends.
- bool canSendOrUpdateMessage(List<ChannelCapability> capabilities) { - var result = capabilities.contains(ChannelCapability.sendMessage); - - final insideThread = _effectiveController.message.parentId != null; - if (insideThread) { - result |= capabilities.contains(ChannelCapability.sendReply); - } - - if (_isEditing) { - result |= capabilities.contains(ChannelCapability.updateOwnMessage); - result |= capabilities.contains(ChannelCapability.updateAnyMessage); - } - - return result; - } + bool canSendOrUpdateMessage(List<ChannelCapability> capabilities) { + final insideThread = _effectiveController.message.parentId != null; + final isBouncedEdit = + _isEditing && _effectiveController.message.isBouncedWithError; + + // If editing a stored message, require update capability strictly. + if (_isEditing && !isBouncedEdit) { + return capabilities.contains(ChannelCapability.updateOwnMessage) || + capabilities.contains(ChannelCapability.updateAnyMessage); + } + + // Composing (or editing a bounced error), follow send rights. + return capabilities.contains(ChannelCapability.sendMessage) || + (insideThread && capabilities.contains(ChannelCapability.sendReply)); + }Verified:
- Not editing, inside thread, only sendReply → input enabled (expected).
- Not editing, channel (no thread), only sendReply → input disabled (expected).
- Editing stored thread message, lacks update rights but has sendReply → currently enabled (bug); editing a bounced-with-error message → enabled and will be sent (expected).
🧹 Nitpick comments (1)
packages/stream_chat_flutter/CHANGELOG.md (1)
1-6
: Unify section naming: prefer “Upcoming” or bump beta version.Top section uses “Upcoming Beta” while the file already has “Upcoming”. Pick one for consistency, or move this bullet under the existing “Upcoming”. Also consider phrasing: “Fixed an issue where users with the
sendReply
capability couldn’t send replies in threads. (FLU-234)”
📜 Review details
Configuration used: CodeRabbit 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.
📒 Files selected for processing (2)
packages/stream_chat_flutter/CHANGELOG.md
(1 hunks)packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-08T14:27:59.621Z
Learnt from: xsahil03x
PR: GetStream/stream-chat-flutter#2348
File: packages/stream_chat_flutter_core/lib/src/stream_channel.dart:383-406
Timestamp: 2025-08-08T14:27:59.621Z
Learning: In stream_chat_flutter_core/lib/src/stream_channel.dart, threads (replies) do not support around-anchor loading. Thread replies are fetched as: initial latest page via StreamChannelState.getReplies(), and further pagination via StreamChannelState.queryReplies(parentId, direction: top|bottom). Anchored loads apply only to channel messages, not to threads.
Applied to files:
packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart
⏰ 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). (2)
- GitHub Check: build (android)
- GitHub Check: test
Submit a pull request
Fixes: FLU-234
Description of the pull request
This PR allows users with the
sendReply
capability to send replies within a thread, even if they don't have broader send message permission.Summary by CodeRabbit
Bug Fixes
Documentation