fix(mobile): name what the handle check refuses in its message

Edit Profile refuses only spaces and invisible characters in a new handle,
as the server does, yet said "Use only letters, numbers and underscores."
from desktop's stricter check, although dots, dashes and CJK handles save.
It now says what it refuses, in every locale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DIYgod
2026-10-13 01:57:18 +08:00
parent 51a32f11ec
commit 850714d788
7 changed files with 9 additions and 2 deletions
@@ -5,7 +5,7 @@ import enCommon from "../../../../../locales/common/en.json"
import enSettings from "../../../../../locales/settings/en.json" import enSettings from "../../../../../locales/settings/en.json"
import { getProfileFieldError, getServerProfileFieldError } from "./profile-validation" import { getProfileFieldError, getServerProfileFieldError } from "./profile-validation"
const INVALID_HANDLE = "Use only letters, numbers and underscores." const INVALID_HANDLE = "Don't use spaces or invisible characters."
describe("getProfileFieldError", () => { describe("getProfileFieldError", () => {
beforeAll(async () => { beforeAll(async () => {
@@ -24,7 +24,9 @@ const countCharacters = (value: string) => Array.from(value).length
const tooLongMessage = (field: ProfileTextField) => const tooLongMessage = (field: ProfileTextField) =>
t("validation.too_long", { ns: "common", count: MAX_LENGTH[field] }) t("validation.too_long", { ns: "common", count: MAX_LENGTH[field] })
const invalidHandleMessage = () => t("profile.handle.invalid", { ns: "settings" }) // Says what is refused. Desktop's message asks for letters, numbers and underscores only, which
// its stricter check requires but this one, like the server, does not
const invalidHandleMessage = () => t("profile.handle.invalid_characters", { ns: "settings" })
/** /**
* Why the server would refuse a profile field's value, as a translated message. The name and the * Why the server would refuse a profile field's value, as a translated message. The name and the
+1
View File
@@ -708,6 +708,7 @@
"profile.email.verify_status": "Your email is {{status}}", "profile.email.verify_status": "Your email is {{status}}",
"profile.handle.description": "Your unique identifier.", "profile.handle.description": "Your unique identifier.",
"profile.handle.invalid": "Use only letters, numbers and underscores.", "profile.handle.invalid": "Use only letters, numbers and underscores.",
"profile.handle.invalid_characters": "Don't use spaces or invisible characters.",
"profile.handle.label": "Handle", "profile.handle.label": "Handle",
"profile.handle.taken": "This handle is already taken.", "profile.handle.taken": "This handle is already taken.",
"profile.link_social.authentication": "Authentication", "profile.link_social.authentication": "Authentication",
+1
View File
@@ -708,6 +708,7 @@
"profile.email.verify_status": "Votre email est {{status}}", "profile.email.verify_status": "Votre email est {{status}}",
"profile.handle.description": "Votre identifiant unique.", "profile.handle.description": "Votre identifiant unique.",
"profile.handle.invalid": "Utilisez uniquement des lettres, des chiffres et des tirets bas.", "profile.handle.invalid": "Utilisez uniquement des lettres, des chiffres et des tirets bas.",
"profile.handle.invalid_characters": "N'utilisez pas d'espaces ni de caractères invisibles.",
"profile.handle.label": "Identifiant", "profile.handle.label": "Identifiant",
"profile.handle.taken": "Cet identifiant est déjà pris.", "profile.handle.taken": "Cet identifiant est déjà pris.",
"profile.link_social.authentication": "Authentification", "profile.link_social.authentication": "Authentification",
+1
View File
@@ -708,6 +708,7 @@
"profile.email.verify_status": "あなたのメールは{{status}}です", "profile.email.verify_status": "あなたのメールは{{status}}です",
"profile.handle.description": "あなた個人の識別子です", "profile.handle.description": "あなた個人の識別子です",
"profile.handle.invalid": "英字、数字、アンダースコアのみ使用できます。", "profile.handle.invalid": "英字、数字、アンダースコアのみ使用できます。",
"profile.handle.invalid_characters": "スペースや見えない文字は使用できません。",
"profile.handle.label": "ハンドル", "profile.handle.label": "ハンドル",
"profile.handle.taken": "このハンドルはすでに使われています。", "profile.handle.taken": "このハンドルはすでに使われています。",
"profile.link_social.authentication": "認証", "profile.link_social.authentication": "認証",
+1
View File
@@ -708,6 +708,7 @@
"profile.email.verify_status": "你的邮件地址{{status}}", "profile.email.verify_status": "你的邮件地址{{status}}",
"profile.handle.description": "你的唯一标识。", "profile.handle.description": "你的唯一标识。",
"profile.handle.invalid": "只能使用字母、数字和下划线。", "profile.handle.invalid": "只能使用字母、数字和下划线。",
"profile.handle.invalid_characters": "不能使用空格或不可见字符。",
"profile.handle.label": "唯一标识", "profile.handle.label": "唯一标识",
"profile.handle.taken": "该唯一标识已被占用。", "profile.handle.taken": "该唯一标识已被占用。",
"profile.link_social.authentication": "身份验证", "profile.link_social.authentication": "身份验证",
+1
View File
@@ -708,6 +708,7 @@
"profile.email.verify_status": "你的電子信箱目前狀態為 {{status}}", "profile.email.verify_status": "你的電子信箱目前狀態為 {{status}}",
"profile.handle.description": "你的獨一無二名稱。", "profile.handle.description": "你的獨一無二名稱。",
"profile.handle.invalid": "只能使用字母、數字和底線。", "profile.handle.invalid": "只能使用字母、數字和底線。",
"profile.handle.invalid_characters": "不能使用空格或不可見字元。",
"profile.handle.label": "名稱", "profile.handle.label": "名稱",
"profile.handle.taken": "此名稱已被使用。", "profile.handle.taken": "此名稱已被使用。",
"profile.link_social.authentication": "驗證", "profile.link_social.authentication": "驗證",