From 7ced16acbfa25d05e8aa67095155672c75950dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 2 Nov 2015 11:19:37 +0100 Subject: [PATCH] FIX: topic.lastPoster should be based on the 'latest' extra --- .../javascripts/discourse/models/topic.js.es6 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/discourse/models/topic.js.es6 b/app/assets/javascripts/discourse/models/topic.js.es6 index 6ed996b33..3530a2929 100644 --- a/app/assets/javascripts/discourse/models/topic.js.es6 +++ b/app/assets/javascripts/discourse/models/topic.js.es6 @@ -13,15 +13,10 @@ const Topic = RestModel.extend({ 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('posters.@each') + lastPoster(posters) { + const latest = posters.filter(p => p.extras && p.extras.indexOf("latest") >= 0)[0]; + return latest.user; }, @computed('fancy_title')