From a04078aa9d8fe0e7d51bc4245891177a8a139957 Mon Sep 17 00:00:00 2001 From: bxdxnn <267911624+bxdxnn@users.noreply.github.com> Date: Fri, 7 Aug 2026 13:38:20 +0000 Subject: [PATCH] Address review --- .../features/poll/impl/create/CreatePollView.kt | 4 ++-- .../android/features/poll/impl/create/PollFormState.kt | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/create/CreatePollView.kt b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/create/CreatePollView.kt index ea234f1b4d..9800af5b88 100644 --- a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/create/CreatePollView.kt +++ b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/create/CreatePollView.kt @@ -259,7 +259,7 @@ private fun MaxSelectionsStepper( ) { Icon( imageVector = CompoundIcons.Minus(), - contentDescription = null, + contentDescription = stringResource(id = CommonStrings.a11y_create_poll_votes_allowed_decrease), modifier = Modifier .clickable(enabled = current > 1) { onDecrement() } .size(32.dp) @@ -277,7 +277,7 @@ private fun MaxSelectionsStepper( ) Icon( imageVector = CompoundIcons.Plus(), - contentDescription = null, + contentDescription = stringResource(id = CommonStrings.a11y_create_poll_votes_allowed_increase), modifier = Modifier .clickable(enabled = current < max) { onIncrement() } .size(32.dp) diff --git a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/create/PollFormState.kt b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/create/PollFormState.kt index eae39a670d..d7198b8c3d 100644 --- a/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/create/PollFormState.kt +++ b/features/poll/impl/src/main/kotlin/io/element/android/features/poll/impl/create/PollFormState.kt @@ -46,8 +46,6 @@ data class PollFormState( * Create a copy of the [PollFormState] with a new blank answer added. * * If the maximum number of answers has already been reached an answer is not added. - * - * Also clamps [maxSelections] to the new answer count to keep state consistent. */ fun withNewAnswer(): PollFormState { if (!canAddAnswer) { @@ -55,8 +53,7 @@ data class PollFormState( } val newAnswers = (answers + "").toImmutableList() - val clampedMaxSelections = maxSelections.coerceIn(1, newAnswers.size) - return copy(answers = newAnswers, maxSelections = clampedMaxSelections) + return copy(answers = newAnswers) } /** @@ -103,11 +100,6 @@ data class PollFormState( */ val canDeleteAnswer get() = answers.size > MIN_ANSWERS - /** - * The effective max selections, clamped to the number of answers. - */ - val effectiveMaxSelections get() = maxSelections.coerceIn(1, answers.size) - /** * Whether the form is currently valid. */