Apply option text limit to suggest poll option dialog#6446
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR adds input length validation to the poll option suggestion dialog. It imports ChangesPoll Option Input Validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
🚀 Available in v6.38.0 |
* 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>



Goal
Apply
PollsConfig.optionTextLimitto the "Suggest an option" dialog so the configured character limit is enforced there too, not only insideCreatePollDialogFragment.Implementation
SuggestPollOptionDialogFragmentnow installs anInputFilter.LengthFilteron the option input whenChatUI.pollsConfig.optionTextLimitis set and positive.Testing
ChatUI.pollsConfig = PollsConfig(optionTextLimit = 10), open a poll that allows suggesting options, tap "Suggest an option", and verify the input cannot exceed 10 characters.ChatUI.pollsConfigleft at its default (optionTextLimit = null), verify the input accepts arbitrarily long text as before.Summary by CodeRabbit