[www] reset dorm button for 2023

This commit is contained in:
Devin Zuczek
2026-10-14 10:42:36 -04:00
parent 94b106c12f
commit 9902de39a4
5 changed files with 208 additions and 1 deletions
+20
View File
@@ -1,6 +1,7 @@
import {
addUsernameChange,
addXp,
clearDormSaveBlob,
clearPasswordHash,
createGift,
getAccount,
@@ -1532,6 +1533,25 @@ export async function clearPasswordHandler(c: Context<App>) {
return c.json({ playerId, hadPassword })
}
/**
* Blank the scene on a player's dorm, for a player going back to the 2023 client: a dorm
* saved by a newer one won't load there. It publishes a new, empty save rather than erasing
* anything, so `previousSaveId` is the save to restore if they want the old dorm back.
* `saveId` is null when there was nothing to clear, which writes nothing and is still
* logged; a player with no dorm at all is a 404.
*/
export async function clearDormHandler(c: Context<App>) {
const playerId = playerIdParam(c)
if (playerId === null) return c.json({ error: 'A numeric player id is required' }, 400)
const cleared = await clearDormSaveBlob(c.env.DB, playerId)
if (cleared === null) return c.json({ error: 'That player has no dorm' }, 404)
await recordPlayerAudit(c, 'clear_dorm', { playerId, ...cleared })
logger.info('staff cleared a dorm', { moderatorId: staffId(c), playerId, ...cleared })
return c.json({ playerId, ...cleared })
}
/**
* Give a player Rec Room Plus by setting `hasPlus` on their account — the same flag the
* Discord benefits claim and `runx admin grant-plus` set, with no Discord link involved.