[econ] gift profanity just in case

This commit is contained in:
Devin Zuczek
2026-08-26 11:21:30 -04:00
parent d31e05d41a
commit 19e1d48807
4 changed files with 55 additions and 2 deletions
@@ -1464,6 +1464,31 @@ describe('econ endpoints', () => {
expect(received?.payload).toMatchObject({ FromPlayerId: 1 })
})
test('POST /api/storefronts/v2/buyItem masks swears in the gift message', async () => {
await seedAccount(208, 'MaskedReceiver')
await drainFrames()
const res = await giftBackpack('334', {
ToPlayerId: 208,
Message: 'happy birthday you shit',
Anonymous: false,
GiftContext: 500,
})
expect(res.status).toBe(200)
// The buyer writes it and someone else reads it, so it is filtered like any other
// player-typed string — masked per character, never refused.
const masked = 'happy birthday you ****'
expect(
((await res.json()) as { BalanceUpdates: Array<{ Data: Array<{ Message: string }> }> })
.BalanceUpdates[0]?.Data[0]?.Message
).toBe(masked)
const [gift] = await pendingGifts('208')
expect(gift?.Message).toBe(masked)
const received = (await drainFrames()).find(
(f) => f.notificationType === NotificationType.GiftPackageReceivedImmediate
)
expect(received?.payload).toMatchObject({ Message: masked })
})
test('POST /api/storefronts/v2/buyItem 404s a gift to a player that does not exist', async () => {
await drainFrames()
const res = await giftBackpack('332', { ToPlayerId: 999999, Message: 'hi', Anonymous: false })