v4: the slug and rename fields lose their hints about old links — "Links to the old address keep working." under the dump and playlist link field, and "Their old name keeps leading to them…" under the moderator's rename field, described a server guarantee nobody filling the form needs to read. Only the fields' errors show under them now; UsernameField loses its hint prop. 670 frontend tests pass, tsc and i18n:compile --strict are clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
khannurien
2026-10-08 21:28:01 +00:00
parent 437eea0df3
commit 45e004b465
7 changed files with 66 additions and 100 deletions

View File

@@ -63,12 +63,6 @@ export function ProfileManageTab(
key={user.username}
username={user.username}
save={rename}
hint={
<Trans>
Their old name keeps leading to them, and nobody else can take
it.
</Trans>
}
/>
</SettingRow>
</div>

View File

@@ -5,7 +5,6 @@
* @module
*/
import type { ReactNode } from "react";
import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import { FormProvider } from "react-hook-form";
@@ -23,17 +22,14 @@ export interface UsernameFieldProps {
* field shows.
*/
save: (username: string) => Promise<string>;
/** Shown under the field, such as what becomes of the old name. */
hint?: ReactNode;
}
/**
* Renders the name in a text input with a "Rename" button, which is enabled
* once the name differs. The old name keeps leading to the user, as the hint
* should say.
* once the name differs.
*/
export function UsernameField(
{ username, save, hint }: UsernameFieldProps,
{ username, save }: UsernameFieldProps,
): React.JSX.Element {
const form = useApiForm<{ username: string }>({
defaultValues: { username },
@@ -77,7 +73,6 @@ export function UsernameField(
{String(error.message)}
</span>
)}
{hint && <p className="form-hint">{hint}</p>}
<FormError title={t`Could not rename`} />
</form>
</FormProvider>