Polls: Longer question length and 1:1 Receive Support

Co-authored-by: jimio <jimio@jimio-m3-max.local>
Co-authored-by: Yash <yash@signal.org>
This commit is contained in:
jimio
2026-01-05 14:00:42 -08:00
committed by GitHub
parent 8030284a40
commit 0400da993c
6 changed files with 145 additions and 89 deletions

View File

@@ -18,7 +18,8 @@ import { getEmojiVariantByKey } from './fun/data/emojis.std.js';
import { strictAssert } from '../util/assert.std.js';
import {
type PollCreateType,
POLL_QUESTION_MAX_LENGTH,
POLL_QUESTION_MAX_LENGTH_SEND,
POLL_OPTION_MAX_LENGTH,
POLL_OPTIONS_MIN_COUNT,
POLL_OPTIONS_MAX_COUNT,
} from '../types/Polls.dom.js';
@@ -188,7 +189,7 @@ export function PollCreateModal({
}
// Don't insert if it would exceed the max grapheme length
if (countGraphemes(newValue) > POLL_QUESTION_MAX_LENGTH) {
if (countGraphemes(newValue) > POLL_OPTION_MAX_LENGTH) {
return opt; // Return unchanged
}
@@ -314,8 +315,8 @@ export function PollCreateModal({
value={question}
onChange={handleQuestionChange}
placeholder={i18n('icu:PollCreateModal__questionPlaceholder')}
maxLengthCount={POLL_QUESTION_MAX_LENGTH}
whenToShowRemainingCount={POLL_QUESTION_MAX_LENGTH - 30}
maxLengthCount={POLL_QUESTION_MAX_LENGTH_SEND}
whenToShowRemainingCount={POLL_QUESTION_MAX_LENGTH_SEND - 30}
aria-invalid={validationErrors.question || undefined}
aria-errormessage={
validationErrors.question ? 'poll-question-error' : undefined
@@ -340,8 +341,8 @@ export function PollCreateModal({
placeholder={i18n('icu:PollCreateModal__optionPlaceholder', {
number: String(index + 1),
})}
maxLengthCount={POLL_QUESTION_MAX_LENGTH}
whenToShowRemainingCount={POLL_QUESTION_MAX_LENGTH - 30}
maxLengthCount={POLL_OPTION_MAX_LENGTH}
whenToShowRemainingCount={POLL_OPTION_MAX_LENGTH - 30}
aria-invalid={validationErrors.options || undefined}
aria-errormessage={
validationErrors.options ? 'poll-options-error' : undefined