<commit_before>/* global Travis */
import Ember from 'ember';
import { config } from 'travis/config/environment';
import { service } from 'ember-decorators/service';
import { computed, action } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';

export default Ember.Controller.extend({
  @service auth: null,

  allHooks: [],

  @alias('auth.currentUser') user: null,

  init() {
    this._super(...arguments);

    return Travis.on('user:synced', () => { this.reloadHooks(); });
  },


  @action
  sync() {
    return this.get('user').sync();
  },

  @action
  toggle(hook) {
    return hook.toggle();
  },

  reloadHooks() {
    let login = this.get('model.login');
    if (login) {
      let hooks = this.store.query('hook', {
        all: true,
        owner_name: login,
        order: 'none'
      });
      this.set('loadingError', false);
      hooks.then(() => {
        hooks.set('isLoaded', true);
      }).catch(() => {
        this.set('loadingError', true);
      });
      return this.set('allHooks', hooks);
    }
  },

  @computed('model.{name,login}')
  accountName(name, login) {
    return name || login;
  },

  @computed('allHooks.[]')
  hooks(hooks) {
    if (!hooks) {
      this.reloadHooks();
    }
    return hooks.filter(hook => hook.get('admin')).sortBy('name');
  },

  @computed('allHooks.[]')
  hooksWithoutAdmin(hooks) {
    if (!hooks) {
      this.reloadHooks();
    }
    return hooks.filter(hook => !hook.get('admin')).sortBy('name');
  },

  @computed('model.{type,login}')
  billingUrl(type, name, login) {
    const id = type === 'user' ? 'user' : login;
    return `${config.billingEndpoint}/subscriptions/${id}`;
  },

  @computed('billingUrl', 'model.{subscribed,education}')
  subscribeButtonInfo(billingUrl, subscribed, education) {
    return {
      billingUrl,
      subscribed,
      education,
    };
  },
});
<commit_msg>Fix bad import that failed profile page without errors<commit_after>/* global Travis */
import Ember from 'ember';
import config from 'travis/config/environment';
import { service } from 'ember-decorators/service';
import { computed, action } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';

export default Ember.Controller.extend({
  @service auth: null,

  allHooks: [],

  @alias('auth.currentUser') user: null,

  init() {
    this._super(...arguments);

    return Travis.on('user:synced', () => { this.reloadHooks(); });
  },


  @action
  sync() {
    return this.get('user').sync();
  },

  @action
  toggle(hook) {
    return hook.toggle();
  },

  reloadHooks() {
    let login = this.get('model.login');
    if (login) {
      let hooks = this.store.query('hook', {
        all: true,
        owner_name: login,
        order: 'none'
      });
      this.set('loadingError', false);
      hooks.then(() => {
        hooks.set('isLoaded', true);
      }).catch(() => {
        this.set('loadingError', true);
      });
      return this.set('allHooks', hooks);
    }
  },

  @computed('model.{name,login}')
  accountName(name, login) {
    return name || login;
  },

  @computed('allHooks.[]')
  hooks(hooks) {
    if (!hooks) {
      this.reloadHooks();
    }
    return hooks.filter(hook => hook.get('admin')).sortBy('name');
  },

  @computed('allHooks.[]')
  hooksWithoutAdmin(hooks) {
    if (!hooks) {
      this.reloadHooks();
    }
    return hooks.filter(hook => !hook.get('admin')).sortBy('name');
  },

  @computed('model.{type,login}')
  billingUrl(type, name, login) {
    const id = type === 'user' ? 'user' : login;
    return `${config.billingEndpoint}/subscriptions/${id}`;
  },

  @computed('billingUrl', 'model.{subscribed,education}')
  subscribeButtonInfo(billingUrl, subscribed, education) {
    return {
      billingUrl,
      subscribed,
      education,
    };
  },
});

{'fraction_non_alphanumeric': 0.18492618492618493, 'fraction_numerical': 0.0, 'mean_word_length': 3.02711157455683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1278091', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1280, 'n_words': 240}