mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-26 23:48:52 -07:00
[www] enable plus for a user
This commit is contained in:
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user