Skip to content

Apply option text limit to suggest poll option dialog#6446

Merged
VelikovPetar merged 1 commit into
v6from
v6-xml-poll-suggest-option-limit
May 20, 2026
Merged

Apply option text limit to suggest poll option dialog#6446
VelikovPetar merged 1 commit into
v6from
v6-xml-poll-suggest-option-limit

Conversation

@gpunto

@gpunto gpunto commented May 19, 2026

Copy link
Copy Markdown
Contributor

Goal

Apply PollsConfig.optionTextLimit to the "Suggest an option" dialog so the configured character limit is enforced there too, not only inside CreatePollDialogFragment.

Implementation

SuggestPollOptionDialogFragment now installs an InputFilter.LengthFilter on the option input when ChatUI.pollsConfig.optionTextLimit is set and positive.

Testing

  • With ChatUI.pollsConfig = PollsConfig(optionTextLimit = 10), open a poll that allows suggesting options, tap "Suggest an option", and verify the input cannot exceed 10 characters.
  • With ChatUI.pollsConfig left at its default (optionTextLimit = null), verify the input accepts arbitrarily long text as before.

Summary by CodeRabbit

  • Bug Fixes
    • Poll option input field now enforces a maximum character limit.

Review Change Stack

@github-actions

github-actions Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

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 (or ignored for dependabot PRs).

🎉 Great job! This PR is ready for review.

@gpunto gpunto added the pr:improvement Improvement label May 19, 2026
@gpunto gpunto changed the title Apply optionTextLimit to suggest poll option dialog Apply option text limit to suggest poll option dialog May 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.26 MB 5.26 MB 0.00 MB 🟢
stream-chat-android-offline 5.49 MB 5.49 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.64 MB 10.66 MB 0.01 MB 🟢
stream-chat-android-compose 12.87 MB 12.87 MB 0.00 MB 🟢

@sonarqubecloud

Copy link
Copy Markdown

@gpunto gpunto marked this pull request as ready for review May 19, 2026 14:44
@gpunto gpunto requested a review from a team as a code owner May 19, 2026 14:44
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 45b98867-9f65-404f-a86a-5f1ed6f4af66

📥 Commits

Reviewing files that changed from the base of the PR and between d404872 and 25bc2f4.

📒 Files selected for processing (1)
  • stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/internal/poll/SuggestPollOptionDialogFragment.kt

Walkthrough

This PR adds input length validation to the poll option suggestion dialog. It imports InputFilter and applies a LengthFilter to the text input field based on the configured maximum option text length from ChatUI.pollsConfig.

Changes

Poll Option Input Validation

Layer / File(s) Summary
Poll option length filter enforcement
stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/list/internal/poll/SuggestPollOptionDialogFragment.kt
Adds InputFilter import and conditionally applies InputFilter.LengthFilter to binding.optionInput when ChatUI.pollsConfig.optionTextLimit is non-null and positive.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

Suggested reviewers

  • andremion

Poem

🐰 A hop, a filter, a text field refined,
Poll options now bounded, by length intertwined,
Config whispers limits, the keyboard obeys,
No rambling suggestions—just sensible ways! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately describes the main change: applying the option text limit to the suggest poll option dialog.
Description check ✅ Passed The PR description covers Goal and Implementation sections well. Testing section is present with specific test cases. However, UI Changes and Contributor/Reviewer Checklists are missing from the template.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v6-xml-poll-suggest-option-limit

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.

@VelikovPetar VelikovPetar merged commit 4a3e766 into v6 May 20, 2026
17 of 19 checks passed
@VelikovPetar VelikovPetar deleted the v6-xml-poll-suggest-option-limit branch May 20, 2026 13:05
@stream-public-bot stream-public-bot added the released Included in a release label May 21, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v6.38.0

gpunto added a commit that referenced this pull request May 27, 2026
* Fix MessageListView rotation crash and custom messagesStart not being applied (#6438)

* Add configurable character limits and feature toggles for polls (#6435)

* Add configurable character limits and feature toggles for polls

Introduces PollsConfig to control poll feature availability and enforce character limits on questions and options. Poll features (multiple votes, anonymous voting, suggest options, add comments) can now be
hidden or preset with default values through ChatUI.pollsConfig or passed directly to CreatePollDialogFragment.

* addressing pr comments

* 1. Detekt - Fixed the MaxLineLength violation in PollsConfig.kt:23 by breaking the long comment line
  2. Spotless - Applied formatting fixes (added license header to PollFeatureConfig.kt)
  3. API Check - Regenerated the API dump file

* Update stream-chat-android-ui-components/src/main/kotlin/io/getstream/chat/android/ui/feature/messages/composer/attachment/picker/poll/PollsConfig.kt

Co-authored-by: Gianmarco <47775302+gpunto@users.noreply.github.com>

* Apply suggestion from @gpunto

---------

Co-authored-by: Gianmarco <47775302+gpunto@users.noreply.github.com>

* Allow voters to suggest poll options in UI Components (#6439)

* Allow voters to suggest poll options in UI Components

* Use doAfterTextChanged

* Align Compose & XML option name trimming

* Apply optionTextLimit to suggest poll option dialog (#6446)

* Allow voters to add poll comments in UI Components (#6444)

* Allow voters to add poll comments in UI Components

* Add missing KDoc and default params

* Adjust poll comments commit to develop's APIs

- Use UiCommonR for stream_ui_poll_action_view_comments plural
- Update StateRegistry imports to client.api.state package

* Reformat

* Add default value to pollSuggestOptionTextStyle

* Init poll suggest option confirm button state from current input

* Validate poll text limits at PollsConfig construction

* Make SuggestPollOptionDialogFragment internal for consistency

* Reapply poll feature visibility on rotation in CreatePollDialogFragment

* Add MessageListViewModel test for suggesting a poll option

* Add CreatePollViewModel test for config propagation

---------

Co-authored-by: Ryan Hurst <106116154+ryanhurststrava@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Improvement released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants