wip: fix setting (some) items values in the hall of heroes (#11133)

This commit is contained in:
Matteo Pagliazzi
2019-04-25 22:41:43 +02:00
committed by GitHub
parent 99dec2eb0c
commit 9d473cc92e
3 changed files with 71 additions and 2 deletions

View File

@@ -7,7 +7,10 @@ import {
import _ from 'lodash';
import apiError from '../../libs/apiError';
import validator from 'validator';
import { validateItemPath } from '../../libs/items/utils';
import {
validateItemPath,
castItemVal,
} from '../../libs/items/utils';
let api = {};
@@ -271,7 +274,7 @@ api.updateHero = {
hero.markModified('items.pets');
}
if (updateData.itemPath && updateData.itemVal && validateItemPath(updateData.itemPath)) {
_.set(hero, updateData.itemPath, updateData.itemVal); // Sanitization at 5c30944 (deemed unnecessary)
_.set(hero, updateData.itemPath, castItemVal(updateData.itemPath, updateData.itemVal)); // Sanitization at 5c30944 (deemed unnecessary)
}
if (updateData.auth && updateData.auth.blocked === true) {