Added guard against undefined member name (#1322)

no-issue

This is causing issues since we removed the name property from member
objects. This change stops admin crashing out, but a more correct
handling of the missing name property should happen at a later point.
This commit is contained in:
Fabien O'Carroll 2019-09-12 16:33:03 +08:00 committed by GitHub
parent d9b09f4c4f
commit e6db09620e

View File

@ -30,8 +30,12 @@ export default Component.extend({
}),
initials: computed('member.name', function () {
let names = this.member.name.split(' ');
let intials = [names[0][0], names[names.length - 1][0]];
return intials.join('').toUpperCase();
let name = this.member.name;
if (name) {
let names = name.split(' ');
let intials = [names[0][0], names[names.length - 1][0]];
return intials.join('').toUpperCase();
}
return '';
})
});