FIX: lastPoster not defined correctly in model

This commit is contained in:
Sam Saffron 2015-11-01 14:30:54 +11:00
parent 33fb870e48
commit 0d15dbd886
1 changed files with 15 additions and 1 deletions

View File

@ -8,7 +8,21 @@ const Topic = RestModel.extend({
message: null,
errorLoading: false,
lastPoster: Ember.computed.alias("posters.lastObject.user"),
@computed('posters.firstObject')
creator(poster){
return poster && poster.user;
},
@computed('posters.lastObject')
lastPoster(poster) {
if (poster){
if (this.last_poster_username === poster.user.username){
return poster.user;
} else {
return this.get('creator');
}
}
},
@computed('fancy_title')
fancyTitle(title) {