bug: 2000-character chat cap and chat send errors - #610
Merged
Merged
Conversation
The api now refuses a website chat message over 2000 characters and tells the sender why with chat:error. The chat box refuses an over-length message up front, keeps the text, and counts down over the last 200 characters. chat:error codes become a toast; not_allowed and unknown codes read as a failed send. ChatMessage compares sender steam ids as strings, since new messages carry a string steam_id and older history can carry a number.
chatErrorMessage takes the translate function and calls t() with literal keys, so check-translations no longer reports chat.message_too_long and chat.send_failed as unused. The zod schema trims before measuring, like the send check and the api. French send_failed matches the formal wording around it. Tests for the trimmed countdown, the text kept after an Enter refusal, and ChatMessage grouping.
Every other destructive toast leads with a short sentence-case title, so a chat send error now reads "Failed to send message" as its title, with the length limit as the description when that is the reason. The send_failed strings drop their trailing period to read as titles.
Contributor
Author
|
Design-consistency follow-up (
|
Lines stored before the api stamped from.steam_id as a string can hold it as a number. The test fails without the String() comparison in ChatMessage's isSameSender.
# Conflicts: # tests/web-sockets/Socket.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caps website chat messages at 2000 characters and shows the api's
chat:error, so an over-long message no longer silently vanishes.maxlength, so a paste isn't cut).Socketlistens forchat:errorand toasts it throughutilities/chatErrors.ts(too_longnames the limit, anything else is a generic failure).steam_idas a number.chat.message_too_longandchat.send_failedin all 16 locales.Merge/deploy: pairs with 5stackgg/api#435; deploy the api first.
Tests: the over-cap refusal, the
chat:errortoast and numeric-id grouping each fail with their fix reverted. Based on DEAFCS 29c30a425