[www] enable plus for a user

This commit is contained in:
Devin Zuczek
2026-10-02 13:38:13 -04:00
parent 10973d9685
commit 6167925ee0
4 changed files with 87 additions and 2 deletions
+23
View File
@@ -1291,6 +1291,7 @@ function StaffPlayerActions({ account, navigate }: { account: PublicAccount; nav
const itemGift = useAction()
const usernameChange = useAction()
const clearPassword = useAction()
const grantPlus = useAction()
const base = `/api/staff/players/${account.accountId}`
return (
@@ -1458,6 +1459,26 @@ function StaffPlayerActions({ account, navigate }: { account: PublicAccount; nav
>
{usernameChange.pending ? 'Adding…' : 'Add username change'}
</button>
{/* Developer-only, like the gifts; www refuses it to moderators. */}
{isDeveloper() && (
<button
type="submit"
disabled={grantPlus.pending}
onClick={() =>
void grantPlus.run(async () => {
const res = await call<{ hadPlus: boolean }>(`${base}/grant-plus`, {
authed: true,
method: 'POST',
})
return res.hadPlus
? `@${account.username} already has Plus.`
: `@${account.username} now has Plus. It takes effect the next time they sign in.`
})
}
>
{grantPlus.pending ? 'Granting…' : 'Grant Plus'}
</button>
)}
{confirmingClear ? (
<>
<button
@@ -1509,6 +1530,8 @@ function StaffPlayerActions({ account, navigate }: { account: PublicAccount; nav
{usernameChange.done && <p className="ok">{usernameChange.done}</p>}
{clearPassword.error && <p className="error">{clearPassword.error}</p>}
{clearPassword.done && <p className="ok">{clearPassword.done}</p>}
{grantPlus.error && <p className="error">{grantPlus.error}</p>}
{grantPlus.done && <p className="ok">{grantPlus.done}</p>}
</section>
)
}