import Ember from 'ember';

export default Ember.Component.extend({

  tagName: 'span',
  classNameBindings: ['small:avatar--small:avatar'],

  userInitials: Ember.computed('userInitials', function () {
    let name = this.get('name');
    let arr = name.split(' ');
    let initials = '';

    if (arr.length >= 2) {
      initials = arr[0].split('')[0] + arr[1].split('')[0];
    } else {
      initials = arr[0].split('')[0];
    }
    return initials;
  })

});

import Ember from 'ember';

export default Ember.Component.extend({

  tagName: 'span',
  classNameBindings: ['small:avatar--small:avatar'],

  userInitials: Ember.computed('name', function () {
    let name = this.get('name');
    if (name) {
      let arr = name.split(' ');
      let initials = '';

      if (arr.length >= 2) {
        initials = arr[0].split('')[0] + arr[1].split('')[0];
      } else {
        initials = arr[0].split('')[0];
      }
      return initials;
    }
  })
});

Fix broken PR tab when loading page directly
Fix broken PR tab when loading page directly

This appears to have stopped working recently, but it does not appear
to be related to any changes within the component itself.

I'm adding a guard here as a stop-gap, though we'll need to track down
later what the data changes were that led to this cropping up in the
first place.
