1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

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 Kevin Ansfield
parent f0d6adf416
commit e6c4777795

View file

@ -30,8 +30,12 @@ export default Component.extend({
}),
initials: computed('member.name', function () {
let names = this.member.name.split(' ');
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 '';
})
});