Remove user wrapping (#9960)

* remove user wrapping, fixes #9146

* update tests

* fix tests
This commit is contained in:
Matteo Pagliazzi
2018-02-09 13:46:55 +01:00
committed by GitHub
parent 8e24b0578e
commit f947d3562b
14 changed files with 59 additions and 190 deletions

View File

@@ -607,7 +607,7 @@ api.scoreTask = {
let [delta] = common.ops.scoreTask({task, user, direction}, req);
// Drop system (don't run on the client, as it would only be discarded since ops are sent to the API, not the results)
if (direction === 'up') user.fns.randomDrop({task, delta}, req, res.analytics);
if (direction === 'up') common.fns.randomDrop(user, {task, delta}, req, res.analytics);
// If a todo was completed or uncompleted move it in or out of the user.tasksOrder.todos list
// TODO move to common code?

View File

@@ -470,7 +470,7 @@ api.getUserAnonymized = {
let user = res.locals.user.toJSON();
user.stats.toNextLevel = common.tnl(user.stats.lvl);
user.stats.maxHealth = common.maxHealth;
user.stats.maxMP = res.locals.user._statsComputed.maxMP;
user.stats.maxMP = common.statsComputed(res.locals.user).maxMP;
delete user.apiToken;
if (user.auth) {