Skip to content
Permalink
Browse files

rollback 'spells' to 'special'

  • Loading branch information
negue committed May 15, 2018
1 parent e9a5bf2 commit dea711439ade9d4c2ab6f03e11e08a4861bd70fd
@@ -112,7 +112,7 @@ describe('shared.ops.buy', () => {
params: {
key: 'thankyou',
},
type: 'spells',
type: 'special',
});

expect(user.stats.gp).to.equal(1);
@@ -164,7 +164,7 @@ module.exports = function getItemInfo (user, type, item, officialPinnedItems, la
type: 'special',
currency: 'gold',
locked: false,
purchaseType: 'spells',
purchaseType: 'special',
class: `inventory_special_${item.key}`,
path: `spells.special.${item.key}`,
pinType: 'seasonalSpell',
@@ -70,7 +70,7 @@ module.exports = function buy (user, req = {}, analytics) {
buyRes = buyOp.purchase();
break;
}
case 'spells': {
case 'special': {
const buyOp = new BuySpellOperation(user, req, analytics);

buyRes = buyOp.purchase();
No changes.
@@ -7,6 +7,7 @@ import {
NotFound,
} from '../../libs/errors';
import {AbstractGoldItemOperation} from './abstractBuyOperation';
import errorMessage from '../../libs/errorMessage';

export class BuySpellOperation extends AbstractGoldItemOperation {
constructor (user, req, analytics) {
@@ -23,10 +24,10 @@ export class BuySpellOperation extends AbstractGoldItemOperation {

extractAndValidateParams (user, req) {
let key = this.key = get(req, 'params.key');
if (!key) throw new BadRequest(this.i18n('missingKeyParam'));
if (!key) throw new BadRequest(errorMessage('missingKeyParam'));

let item = content.special[key];
if (!item) throw new NotFound(this.i18n('spellNotFound', {spellId: key}));
if (!item) throw new NotFound(errorMessage('spellNotFound', {spellId: key}));

this.canUserPurchase(user, item);
}
@@ -610,7 +610,7 @@ api.buy = {
// @TODO: Remove this when mobile passes type in body
let type = req.params.key;
if (buySpecialKeys.indexOf(type) !== -1) {
req.type = 'spells';
req.type = 'special';
} else if (buyKnownKeys.indexOf(type) === -1) {
req.type = 'marketGear';
}
@@ -884,7 +884,7 @@ api.buySpecialSpell = {
url: '/user/buy-special-spell/:key',
async handler (req, res) {
let user = res.locals.user;
req.type = 'spells';
req.type = 'special';
let buySpecialSpellRes = common.ops.buy(user, req);
await user.save();
res.respond(200, ...buySpecialSpellRes);

0 comments on commit dea7114

Please sign in to comment.
You can’t perform that action at this time.