Skip to content

fix: correct error message for clan tag length (BUG-07)#3946

Merged
ryanbarlow97 merged 2 commits into
openfrontio:mainfrom
berkelmali:fix/bug07-clan-tag-error-message
May 16, 2026
Merged

fix: correct error message for clan tag length (BUG-07)#3946
ryanbarlow97 merged 2 commits into
openfrontio:mainfrom
berkelmali:fix/bug07-clan-tag-error-message

Conversation

@berkelmali
Copy link
Copy Markdown
Contributor

@berkelmali berkelmali commented May 16, 2026

Description:

The code was checking clanTag.length > MAX_CLAN_TAG_LENGTH but returning "tag_too_short". This fix corrects the error message to something more appropriate or ensures the logic matches the message.

Fix: Corrected the error message key from "tag_too_short" to "tag_too_long" when the length exceeds the maximum.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

barfires

When a clan tag exceeds MAX_CLAN_TAG_LENGTH, the validation was
returning 'tag_too_short' instead of 'tag_too_long'. Added the
missing translation key and fixed the test.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Review Change Stack

Walkthrough

This PR fixes a validation bug where validateClanTag returned the wrong error code when clan tags exceeded the maximum length. The validation logic was corrected, the missing English localization entry was added, and the test was updated to assert the correct error.

Changes

Clan Tag Length Validation Fix

Layer / File(s) Summary
Clan tag validation error correction
src/core/validations/username.ts, resources/lang/en.json, tests/Censor.test.ts
validateClanTag was corrected to return username.tag_too_long instead of username.tag_too_short for clan tags exceeding MAX_CLAN_TAG_LENGTH. The corresponding English localization entry and test assertion were added and updated respectively.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A clan tag grew one char too wide,
The error code had missed the tide,
Now "too_long" sings true and clear,
With test and locale standing near! 🏷️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing an incorrect error message for clan tag length validation, with a specific bug reference.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly explains the bug fix: changing the error message from 'tag_too_short' to 'tag_too_long' when clan tag length exceeds the maximum.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ryanbarlow97 ryanbarlow97 added Translation Addition or modification of a language to the translations. Bugfix Fixes a bug labels May 16, 2026
@ryanbarlow97 ryanbarlow97 added this to the v32 milestone May 16, 2026
@github-project-automation github-project-automation Bot moved this from Triage to Final Review in OpenFront Release Management May 16, 2026
@ryanbarlow97 ryanbarlow97 enabled auto-merge May 16, 2026 18:17
@ryanbarlow97 ryanbarlow97 added this pull request to the merge queue May 16, 2026
Merged via the queue into openfrontio:main with commit 4460367 May 16, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Final Review to Complete in OpenFront Release Management May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix Fixes a bug Translation Addition or modification of a language to the translations.

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

2 participants