Skip to content

Conversation

VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Oct 18, 2025

🎯 Goal

Currently the message composer only considered the send-message capability, ignoring the send-reply one. With this PR, we ensure the proper capability is checked, depending on whether the composer is used in a channel or in a thread.

Docs PR: https://github.com/GetStream/docs-content/pull/686

🛠 Implementation details

  • Check send-message capability when in channel
  • Check rend-reply capability when in thread
  • Additional fix: Don't allow sending audio recordings if no rights to send a message (or reply)
  • The checks are now placed in a single file: MessageComposerCapabilities, which expose the canSendMessage and canUploadFile. Note: They are exposed as public, because I think they would be useful to provide to integrators developing custom composers.

🎨 UI Changes

Capabilities Before After
`send-message`, `send-reply`
send-message-reply-before.mp4
send-message-reply-after.mp4
`send-message`
send-message-before.mp4
send-message-after.mp4
`send-reply`
send-reply-before.mp4
send-reply-after.mp4
/
none-before.mp4
none-after.mp4

🧪 Testing

  1. To test without send-message, disable the CreateMessage permission on dashboard
  2. To test without both, disable both CreateMessage and CreateReply permissions on dashboard
  3. To test without send-reply, disable Threads & Replies on dashboard

Copy link
Contributor

github-actions bot commented Oct 18, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.22 MB 3.22 MB 0.00 MB 🟢
stream-chat-android-offline 3.45 MB 3.45 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.54 MB 10.54 MB 0.00 MB 🟢
stream-chat-android-compose 12.76 MB 12.76 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar requested a review from Copilot October 18, 2025 12:23
@VelikovPetar VelikovPetar marked this pull request as ready for review October 18, 2025 12:23
@VelikovPetar VelikovPetar requested a review from a team as a code owner October 18, 2025 12:23
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR centralizes capability checks for the Message Composer and ensures correct handling of send-message vs send-reply based on context (channel vs thread), while tightening audio recording availability to actual send permissions.

  • Introduces public canSendMessage and canUploadFile helpers and replaces scattered checks with these centralized functions.
  • Ensures audio recording controls are hidden when the user cannot send (message or reply).
  • Updates guides and UI components to use the new helpers.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
stream-chat-android-ui-guides/.../MessagesActivity.kt Replaces direct capability checks with canSendMessage/canUploadFile helpers in the sample activity.
stream-chat-android-ui-components/.../DefaultMessageComposerTrailingContent.kt Switches to helpers and simplifies trailing content logic; removes unused utility method.
stream-chat-android-ui-components/.../DefaultMessageComposerLeadingContent.kt Uses capability helpers to gate leading content behavior.
stream-chat-android-ui-components/.../DefaultMessageComposerCenterContent.kt Uses canSendMessage to toggle input enabled state.
stream-chat-android-ui-common/.../MessageComposerCapabilitiesTest.kt Adds parameterized tests for canSendMessage and canUploadFile.
stream-chat-android-ui-common/.../MessageComposerCapabilities.kt Adds public helpers canSendMessage and canUploadFile with documentation.
stream-chat-android-ui-common/api/...ui-common.api Updates public API surface to include new helper functions.
stream-chat-android-docs/.../AddingCustomAttachments.kt Updates Kotlin docs to use new capability helpers.
stream-chat-android-docs/.../AddingCustomAttachments.java Updates Java docs to use new capability helpers via static import.
stream-chat-android-compose/.../MessageComposer.kt Adopts helpers; updates trailing and label behavior; records require send capability.
stream-chat-android-compose/.../MessageInput.kt Uses canSendMessage helper for enabling input.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
76.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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