mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: topic.posters might be null or empty
This commit is contained in:
parent
7ced16acbf
commit
d0fe4fc4b5
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user