<commit_before>ChatterApp = React.createClass({
  mixins: [ReactMeteorData],

  getInitialState: function() {
    return {
      chatOpen: true,
      roomId: null,
      header: "Channels",
      view: "roomList",
      joinedRooms: [],
      otherRooms: []
    };
   },

  getMeteorData () {
    const roomsHandle = Meteor.subscribe("chatterRooms");
    const userRoomsHandle = Meteor.subscribe("chatterUserRooms");
    const subsReady = roomsHandle.ready() && userRoomsHandle.ready();

    let joinedRooms = [];
    let otherRooms = [];

    if (subsReady) {
      const userRooms = Chatter.UserRoom.find({"userId": Meteor.userId()});
      const roomIds = userRooms.map(function(userRoom) { return userRoom.roomId });
      joinedRooms = Chatter.Room.find({"_id": {$in:roomIds}}).fetch();
      otherRooms = Chatter.Room.find({"_id": {$nin:roomIds}}).fetch();
    }

    return {
      joinedRooms,
      otherRooms,
      subsReady
    }
  },

  goToRoom(roomId, roomName) {
    this.setState({
      roomId: roomId,
      view: 'room',
      header: roomName
    });
    Meteor.call("userroom.build", roomName);
  },

  setView(view) {
    this.setState({
      view: view
    });
  },

  toggleChatState() {
    this.setState({
      chatState: !this.state.chatOpen
    });
  },

  getView() {
    const views = {
      "roomList": <RoomList subsReady={this.data.subsReady} goToRoom={this.goToRoom} joinedRooms={this.data.joinedRooms} otherRooms={this.data.otherRooms} getUserCount={this.getUserCount} setView={this.setView} />,
      "room": <Room roomId={this.state.roomId} />,
      "settings": <Settings roomId={this.state.roomId} />,
      "newRoom": <NewRoom goToRoom={this.goToRoom} />,
      "widget": <Widget />
    };
    return views[this.state.view]
  },

  doNavAction(action) {
    const actions = {
      "home": {
        header: "Channels",
        view: "roomList"
      },
      "minimize": {
        chatState: "minimized"
      },
      "settings": {
        view: "settings"
      },
      "room": {
        view: "room"
      }
    };
    this.setState(actions[action]);
  },

  getUserCount(roomId) {
    return parseInt(Chatter.UserRoom.find({"roomId": roomId}).fetch().length);
  },

  render() {
    let chatHTML = (
      <div className="ui right vertical wide visible sidebar chatter" id="chatter">
          <Nav view={this.state.view}  setView={this.setView} chatState={this.state.chatState} roomId={this.state.roomId} header={this.state.header} doNavAction={this.doNavAction} />
          {this.getView()}
      </div><commit_msg>keys in object no longer strings<commit_after>ChatterApp = React.createClass({
  mixins: [ReactMeteorData],

  getInitialState: function() {
    return {
      chatOpen: true,
      roomId: null,
      header: "Channels",
      view: "roomList",
      joinedRooms: [],
      otherRooms: []
    };
   },

  getMeteorData () {
    const roomsHandle = Meteor.subscribe("chatterRooms");
    const userRoomsHandle = Meteor.subscribe("chatterUserRooms");
    const subsReady = roomsHandle.ready() && userRoomsHandle.ready();

    let joinedRooms = [];
    let otherRooms = [];

    if (subsReady) {
      const userRooms = Chatter.UserRoom.find({"userId": Meteor.userId()});
      const roomIds = userRooms.map(function(userRoom) { return userRoom.roomId });
      joinedRooms = Chatter.Room.find({"_id": {$in:roomIds}}).fetch();
      otherRooms = Chatter.Room.find({"_id": {$nin:roomIds}}).fetch();
    }

    return {
      joinedRooms,
      otherRooms,
      subsReady
    }
  },

  goToRoom(roomId, roomName) {
    this.setState({
      roomId: roomId,
      view: 'room',
      header: roomName
    });
    Meteor.call("userroom.build", roomName);
  },

  setView(view) {
    this.setState({
      view: view
    });
  },

  toggleChatState() {
    this.setState({
      chatState: !this.state.chatOpen
    });
  },

  getView() {
    const views = {
      roomList: <RoomList subsReady={this.data.subsReady} goToRoom={this.goToRoom} joinedRooms={this.data.joinedRooms} otherRooms={this.data.otherRooms} getUserCount={this.getUserCount} setView={this.setView} />,
      room: <Room roomId={this.state.roomId} />,
      settings: <Settings roomId={this.state.roomId} />,
      newRoom: <NewRoom goToRoom={this.goToRoom} />,
      widget: <Widget />
    };
    return views[this.state.view]
  },

  doNavAction(action) {
    const actions = {
      home: {
        header: "Channels",
        view: "roomList"
      },
      minimize: {
        chatState: "minimized"
      },
      settings: {
        view: "settings"
      },
      room: {
        view: "room"
      }
    };
    this.setState(actions[action]);
  },

  getUserCount(roomId) {
    return parseInt(Chatter.UserRoom.find({"roomId": roomId}).fetch().length);
  },

  render() {
    let chatHTML = (
      <div className="ui right vertical wide visible sidebar chatter" id="chatter">
          <Nav view={this.state.view}  setView={this.setView} chatState={this.state.chatState} roomId={this.state.roomId} header={this.state.header} doNavAction={this.doNavAction} />
          {this.getView()}
      </div>
{'fraction_non_alphanumeric': 0.15722903288577544, 'fraction_numerical': 0.0, 'mean_word_length': 2.773861967694567, 'pattern_counts': {'":': 17, '<': 19, '<?xml version=': 0, '>': 19, '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': '4699721', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1709, 'n_words': 282}