mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +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')
|
@computed('posters.@each')
|
||||||
lastPoster(posters) {
|
lastPoster(posters) {
|
||||||
|
if (posters && posters.length > 0) {
|
||||||
const latest = posters.filter(p => p.extras && p.extras.indexOf("latest") >= 0)[0];
|
const latest = posters.filter(p => p.extras && p.extras.indexOf("latest") >= 0)[0];
|
||||||
return latest.user;
|
return latest.user;
|
||||||
|
} else {
|
||||||
|
return this.get("creator");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed('fancy_title')
|
@computed('fancy_title')
|
||||||
|
Reference in New Issue
Block a user