<commit_before>import Ember from 'ember';
import editManager from '../../utils/edit_manager';
import stashes from '../../utils/_stashes';
import modal from '../../utils/modal';
import app_state from '../../utils/app_state';
import i18n from '../../utils/i18n';
import CoughDrop from '../../app';
import contentGrabbers from '../../utils/content_grabbers';
import persistence from '../../utils/persistence';

export default Ember.Route.extend({
  model: function(params) {
    var res = this.modelFor('board');
    if(res.get('should_reload')) {
      res.set('should_reload', false);
      return res.reload();
    }
    return res;
  },
  setupController: function(controller, model) {
    var _this = this;
    controller.set('model', model);
    model.set('show_history', false);
    model.load_button_set();
    app_state.set('currentBoardState', {
      id: model.get('id'),
      key: model.get('key'),
      name: model.get('name'),
      parent_key: model.get('parent_board_key')
    });
    if(CoughDrop.embedded && !app_state.get('speak_mode')) {
      var state = app_state.get('currentBoardState');
      app_state.toggle_mode('speak', {override_state: state});
      stashes.persist('root_board_state', state);
    }
    editManager.setup(controller);
    app_state.set('board_virtual_dom.sendAction', function(action, id, extra) {
      controller.send(action, id, extra);
    });
    contentGrabbers.board_controller = controller;
    model.without_lookups(function() {
      controller.processButtons();
    });
    model.prefetch_linked_boards();

    // if you have the model.id but not permissions, that means you got it from an /index
    // call and it doesn't actually have all the information you need to render, so you<commit_msg>lock to home board when embedding and currently-logged-in<commit_after>import Ember from 'ember';
import editManager from '../../utils/edit_manager';
import stashes from '../../utils/_stashes';
import modal from '../../utils/modal';
import app_state from '../../utils/app_state';
import i18n from '../../utils/i18n';
import CoughDrop from '../../app';
import contentGrabbers from '../../utils/content_grabbers';
import persistence from '../../utils/persistence';

export default Ember.Route.extend({
  model: function(params) {
    var res = this.modelFor('board');
    if(res.get('should_reload')) {
      res.set('should_reload', false);
      return res.reload();
    }
    return res;
  },
  setupController: function(controller, model) {
    var _this = this;
    controller.set('model', model);
    model.set('show_history', false);
    model.load_button_set();
    app_state.set('currentBoardState', {
      id: model.get('id'),
      key: model.get('key'),
      name: model.get('name'),
      parent_key: model.get('parent_board_key')
    });
    if(CoughDrop.embedded && !app_state.get('speak_mode')) {
      var state = app_state.get('currentBoardState');
      app_state.toggle_mode('speak', {override_state: state});
      if(app_state.get('currentUser.preferences.home_board')) {
        app_state.toggle_home_lock(true);
      }
      stashes.persist('root_board_state', state);
    }
    editManager.setup(controller);
    app_state.set('board_virtual_dom.sendAction', function(action, id, extra) {
      controller.send(action, id, extra);
    });
    contentGrabbers.board_controller = controller;
    model.without_lookups(function() {
      controller.processButtons();
    });
    model.prefetch_linked_boards();

    // if you have the model.id but not permissions, that means you got it from an /index
    // call and it doesn't actually have all the information you need to render, so you
{'fraction_non_alphanumeric': 0.1535733769776323, 'fraction_numerical': 0.002182214948172395, 'mean_word_length': 3.4828850855745723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '959903', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1094, 'n_words': 258}