v4: a user from another instance can't be renamed from their profile's manage tab — it offered the name field to every user, and the API refuses a remote one's rename with a 400, since their home names them. The tab now only shows their name, as the settings do for one's own.

The profile's and the settings' tests of a remote account's links to its home still expected the home's host itself, which 8bcc005 replaced with GET /api/users/:key/home; they now expect that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
khannurien
2026-10-09 22:15:54 +00:00
parent f1bc23a65e
commit 669e65a3a2
3 changed files with 32 additions and 8 deletions

View File

@@ -13,6 +13,7 @@ import type { PublicUser } from "../../../shared/user.ts";
import { expectOk } from "../../utils/shared/api.ts";
import { deserializePublicUser } from "../../utils/shared/deserialize.ts";
import { useAuth } from "../../hooks/auth/useAuth.ts";
import { homeHost } from "../../utils/auth/home.ts";
import { ProfileSection } from "./ProfileSection.tsx";
import { RoleSwitcher } from "./RoleSwitcher.tsx";
import { SettingRow } from "./SettingRow.tsx";
@@ -30,7 +31,8 @@ export interface ProfileManageTabProps {
/**
* Renders the user's role and name. A rename here has no rate limit, and the
* profile's URL then takes the new name.
* profile's URL then takes the new name. A user from another instance is
* named there, so their name is only shown.
*/
export function ProfileManageTab(
{ user, onUserSaved }: ProfileManageTabProps,
@@ -59,11 +61,15 @@ export function ProfileManageTab(
onSaved={(role) => onUserSaved({ ...user, role })}
/>
<SettingRow label={<Trans>Username</Trans>}>
<UsernameField
key={user.username}
username={user.username}
save={rename}
/>
{homeHost(user.username)
? <span className="profile-appearance-value">{user.username}</span>
: (
<UsernameField
key={user.username}
username={user.username}
save={rename}
/>
)}
</SettingRow>
</div>
</ProfileSection>