From fbce5aae32be563fd9333fb1c4e3a6e6e53ce04f Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Tue, 7 May 2024 14:50:12 +0200 Subject: [PATCH] fix buying animal gear --- .../v3/integration/user/POST-user_purchase.test.js | 14 ++++++++++++++ website/common/script/ops/buy/purchase.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/api/v3/integration/user/POST-user_purchase.test.js b/test/api/v3/integration/user/POST-user_purchase.test.js index c21692bc4c..0763913717 100644 --- a/test/api/v3/integration/user/POST-user_purchase.test.js +++ b/test/api/v3/integration/user/POST-user_purchase.test.js @@ -33,6 +33,20 @@ describe('POST /user/purchase/:type/:key', () => { expect(user.items[type][key]).to.equal(1); }); + it('purchases animal ears', async () => { + await user.post('/user/purchase/gear/headAccessory_special_tigerEars'); + await user.sync(); + + expect(user.items.gear.owned.headAccessory_special_tigerEars).to.equal(true); + }); + + it('purchases animal tails', async () => { + await user.post('/user/purchase/gear/back_special_pandaTail'); + await user.sync(); + + expect(user.items.gear.owned.back_special_pandaTail).to.equal(true); + }); + it('can convert gold to gems if subscribed', async () => { const oldBalance = user.balance; await user.updateOne({ diff --git a/website/common/script/ops/buy/purchase.js b/website/common/script/ops/buy/purchase.js index 110a000478..15edeb20a1 100644 --- a/website/common/script/ops/buy/purchase.js +++ b/website/common/script/ops/buy/purchase.js @@ -102,7 +102,7 @@ export default async function purchase (user, req = {}, analytics) { if (!matchers.match(item.key)) { throw new NotAuthorized(i18n.t('messageNotAvailable', req.language)); } - } else if (item.klass === 'special') { + } else if (item.klass === 'special' && item.gearSet !== 'animal') { const matchers = getScheduleMatchingGroup('seasonalGear'); if (!matchers.match(item.set)) { throw new NotAuthorized(i18n.t('messageNotAvailable', req.language));