mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: User page broke when the user had no stats
This commit is contained in:
parent
a43ed88699
commit
35128c212b
1 changed files with 7 additions and 4 deletions
|
@ -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 a new issue