FIX: Index out of range error

Fixes 'index out of range error' that occurs when viewing a user's
profile page when they haven't yet posted a reply or created a topic
and is @mentioned in a topic.
This commit is contained in:
Eric Kelly 2013-08-30 00:43:54 -04:00
parent 380a6c9e9d
commit b70a38f485

View file

@ -345,7 +345,7 @@ Discourse.User.reopenClass(Discourse.Singleton, {
var result = Em.A(); var result = Em.A();
result.pushObjects(stats.rejectProperty('isResponse')); result.pushObjects(stats.rejectProperty('isResponse'));
var insertAt = 1; var insertAt = 0;
result.forEach(function(item, index){ result.forEach(function(item, index){
if(item.action_type === Discourse.UserAction.TYPES.topics || item.action_type === Discourse.UserAction.TYPES.posts){ if(item.action_type === Discourse.UserAction.TYPES.topics || item.action_type === Discourse.UserAction.TYPES.posts){
insertAt = index + 1; insertAt = index + 1;