mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FIX: topic.posters might be null or empty
This commit is contained in:
@ -15,8 +15,12 @@ const Topic = RestModel.extend({
|
||||
|
||||
@computed('posters.@each')
|
||||
lastPoster(posters) {
|
||||
const latest = posters.filter(p => p.extras && p.extras.indexOf("latest") >= 0)[0];
|
||||
return latest.user;
|
||||
if (posters && posters.length > 0) {
|
||||
const latest = posters.filter(p => p.extras && p.extras.indexOf("latest") >= 0)[0];
|
||||
return latest.user;
|
||||
} else {
|
||||
return this.get("creator");
|
||||
}
|
||||
},
|
||||
|
||||
@computed('fancy_title')
|
||||
|
Reference in New Issue
Block a user