feat(composer): live character counter near the message-length cap (LC-332) #344
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-332-composer-char-counter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds a live character counter to the message composer so a user gets feedback as they approach the 16,000-char message-length cap (
MAX_MESSAGE_CHARS, LC-153) instead of only discovering it as a generic 400 failure banner after the send fails.Behavior:
How
max_message_chars()method onRoomPage,DmPage, andComposerFragment(the three structs that renderroom/composer.html), emitted asdata-lc-maxcharson the form. Single source of truth stays the Rust const; no magic number in the template.Array.from(value).length) so the client count matches the server'sbody.chars().count()for emoji / astral input;value.length(UTF-16 code units) would over-count and disagree with the server gate.window.__lcOverLimit; the existingwindow.__lcRefreshSendpredicate was extended to keep Send disabled while over-limit, composing with the existing "text or attachment present" rule rather than fighting it.#composercleanup-root teardown pattern as the other composer scripts and clears the stale flag on form swap.en+es. They use a brace-free%n%token (a plain string, not a Fluent placeable) substituted client-side, so the Fluent text round-trips without brace-escaping.Testing
just check(server compiles; Askama validates the template method call)just testandjust test-saasboth green (incl. i18n en/es parity)No operator action: pure UI, no env var / config / contract change.
🤖 Generated with Claude Code