Skip to content

Display the "Unsupported attachment" in the message composer#6256

Merged
andremion merged 3 commits intov7from
redesign/composer-unsupport-attachments
Mar 16, 2026
Merged

Display the "Unsupported attachment" in the message composer#6256
andremion merged 3 commits intov7from
redesign/composer-unsupport-attachments

Conversation

@andremion
Copy link
Contributor

@andremion andremion commented Mar 16, 2026

Goal

Display the "Unsupported attachment" in the message composer

Implementation

Display the "Unsupported attachment" when a file does not have title nor name

Testing

  • Edit a message that includes unsupported files.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the message composer's handling of attachments with missing names or titles. Attachments without proper identification now display "Unsupported attachment" instead of blank fields, providing clearer visibility to users.

…d attachment" string as a fallback when both `attachment.title` and `attachment.name` are null.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 16, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@andremion andremion changed the title Update MessageComposerAttachmentFileItem to display the "Unsupporte… Display the "Unsupported attachment" in the message composer Mar 16, 2026
@andremion andremion added the pr:ignore-for-release Exclude from release notes label Mar 16, 2026
@andremion andremion marked this pull request as ready for review March 16, 2026 16:06
@andremion andremion requested a review from a team as a code owner March 16, 2026 16:06
@github-actions
Copy link
Contributor

github-actions bot commented Mar 16, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.70 MB 0.45 MB 🟡
stream-chat-android-ui-components 10.60 MB 11.00 MB 0.41 MB 🟡
stream-chat-android-compose 12.81 MB 12.03 MB -0.78 MB 🚀

@andremion andremion enabled auto-merge (squash) March 16, 2026 16:07
@andremion andremion added pr:improvement Improvement and removed pr:ignore-for-release Exclude from release notes labels Mar 16, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Walkthrough

The changes improve file attachment display in the message composer by introducing a localized fallback message. Previously, missing attachment metadata resulted in an empty string; now it displays "Unsupported attachment" retrieved from string resources, with a defined fallback hierarchy: attachment.title → attachment.name → localized string.

Changes

Cohort / File(s) Summary
Attachment Display Localization
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/attachments/MessageComposerAttachmentFileItem.kt
Updated file name display logic to use a localized string resource fallback instead of an empty string when both attachment.title and attachment.name are null.
String Resource Addition
stream-chat-android-compose/src/main/res/values/strings.xml
Added new string resource stream_compose_message_composer_unsupported_attachment with value "Unsupported attachment" for UI display.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A string of text, so small and neat,
Found its home where attachments meet,
"Unsupported" now says with grace,
When titles vanish without a trace!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete, missing several required template sections including UI Changes (screenshots/videos), Testing details, Contributor Checklist, and a GIF. Add missing sections: UI Changes with before/after screenshots or videos, complete Testing section with detailed test instructions, mark relevant Contributor Checklist items, and include a GIF describing the work.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: adding a fallback display of 'Unsupported attachment' in the message composer component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch redesign/composer-unsupport-attachments
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/attachments/MessageComposerAttachmentFileItem.kt (1)

79-81: Consider incorporating attachment.fallback in the hierarchy.

The Attachment model has a fallback field documented as "Fallback text used when [title] and [name] are absent." Other places in the codebase (e.g., MessagePreviewFormatter) use the pattern title ?: name ?: fallback ?: "". You might want to check attachment.fallback before falling back to the localized string, in case the server provides a meaningful fallback value:

text = attachment.title
    ?: attachment.name
    ?: attachment.fallback
    ?: stringResource(R.string.stream_compose_message_composer_unsupported_attachment),

That said, if the intent is to always show "Unsupported attachment" for files without metadata in the composer context specifically, the current implementation is fine.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/attachments/MessageComposerAttachmentFileItem.kt`
around lines 79 - 81, The text selection for the attachment label in
MessageComposerAttachmentFileItem should include attachment.fallback before
falling back to the localized unsupported message; update the expression used to
set text (the assignment that currently uses attachment.title ?: attachment.name
?:
stringResource(R.string.stream_compose_message_composer_unsupported_attachment))
to check attachment.fallback (i.e., title ?: name ?: fallback ?:
stringResource(...)) so any server-provided fallback is shown when title and
name are absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/attachments/MessageComposerAttachmentFileItem.kt`:
- Around line 79-81: The text selection for the attachment label in
MessageComposerAttachmentFileItem should include attachment.fallback before
falling back to the localized unsupported message; update the expression used to
set text (the assignment that currently uses attachment.title ?: attachment.name
?:
stringResource(R.string.stream_compose_message_composer_unsupported_attachment))
to check attachment.fallback (i.e., title ?: name ?: fallback ?:
stringResource(...)) so any server-provided fallback is shown when title and
name are absent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f8fd613c-a4ba-40c7-b357-f25fc80a654d

📥 Commits

Reviewing files that changed from the base of the PR and between fc8918f and 534f7f0.

📒 Files selected for processing (2)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/internal/attachments/MessageComposerAttachmentFileItem.kt
  • stream-chat-android-compose/src/main/res/values/strings.xml

@sonarqubecloud
Copy link

@andremion andremion merged commit 73ff34a into v7 Mar 16, 2026
15 checks passed
@andremion andremion deleted the redesign/composer-unsupport-attachments branch March 16, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants