<commit_before>import Component from '@ember/component';
import layout from './template';
import { computed } from '@ember/object';
import { get, set } from '@ember/object';

export default Component.extend({
  layout,
  tagName:    'TR',
  classNames: 'main-row',

  member:     null,
  roles:      null,
  owner: null,
  type:  null,

  actions: {
    remove: function () {
      this.sendAction('remove', get(this,'member'));
    }
  },

  init: function () {
    this._super(...arguments);
    set(this, 'choices', get(this,'roles').map(role => {
      return {
        label: role.name,
        value: role.id,
      };
    }));
  },

  userList:   computed('users.[]', function() {
    return (get(this, 'users')||[]).map(( user ) =>{ return {label: get(user, 'name'), value: get(user, 'id')} });
  }),

  kind: computed('member.subjectKind', function () {
    if (get(this, 'owner')) {
      return `projectsPage.new.form.members.${get(this,'owner.type').toLowerCase()}`; // TODO translations
    } else {
      return `projectsPage.new.form.members.${get(this,'member.subjectKind').toLowerCase()}`
    }
  })
});
<commit_msg>filter role choices to non-hidden roles<commit_after>import Component from '@ember/component';
import layout from './template';
import { computed } from '@ember/object';
import { get, set } from '@ember/object';

export default Component.extend({
  layout,
  tagName:    'TR',
  classNames: 'main-row',

  member:     null,
  roles:      null,
  owner: null,
  type:  null,

  actions: {
    remove: function () {
      this.sendAction('remove', get(this,'member'));
    }
  },

  init: function () {
    this._super(...arguments);
    set(this, 'choices', get(this,'roles').filterBy('hidden', false).map(role => {
      return {
        label: role.name,
        value: role.id,
      };
    }));
  },

  userList:   computed('users.[]', function() {
    return (get(this, 'users')||[]).map(( user ) =>{ return {label: get(user, 'name'), value: get(user, 'id')} });
  }),

  kind: computed('member.subjectKind', function () {
    if (get(this, 'owner')) {
      return `projectsPage.new.form.members.${get(this,'owner.type').toLowerCase()}`; // TODO translations
    } else {
      return `projectsPage.new.form.members.${get(this,'member.subjectKind').toLowerCase()}`
    }
  })
});

{'fraction_non_alphanumeric': 0.19715271786022434, 'fraction_numerical': 0.0, 'mean_word_length': 3.193490054249548, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '12765', 'n_tokens_mistral': 747, 'n_tokens_neox': 752, 'n_words': 158}