mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
FIX: topic.posters might be null or empty
This commit is contained in:
parent
7ced16acbf
commit
d0fe4fc4b5
1 changed files with 6 additions and 2 deletions
|
@ -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 a new issue