mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 21:19:41 -06:00
FIX: User page broke when the user had no stats
This commit is contained in:
parent
a43ed88699
commit
35128c212b
@ -252,10 +252,13 @@ Discourse.User = Discourse.Model.extend({
|
||||
return PreloadStore.getAndRemove("user_" + user.get('username'), function() {
|
||||
return Discourse.ajax("/users/" + user.get('username') + '.json');
|
||||
}).then(function (json) {
|
||||
json.user.stats = Discourse.User.groupStats(_.map(json.user.stats,function(s) {
|
||||
if (s.count) s.count = parseInt(s.count, 10);
|
||||
return Discourse.UserActionStat.create(s);
|
||||
}));
|
||||
|
||||
if (!Em.isEmpty(json.user.stats)) {
|
||||
json.user.stats = Discourse.User.groupStats(_.map(json.user.stats,function(s) {
|
||||
if (s.count) s.count = parseInt(s.count, 10);
|
||||
return Discourse.UserActionStat.create(s);
|
||||
}));
|
||||
}
|
||||
|
||||
if (json.user.invited_by) {
|
||||
json.user.invited_by = Discourse.User.create(json.user.invited_by);
|
||||
|
Loading…
Reference in New Issue
Block a user