<commit_before>import React from 'react';
import Reflux from 'reflux';
import ApiMixin from '../mixins/apiMixin';
import DocumentTitle from 'react-document-title';
import GroupHeader from './groupDetails/header';
import GroupStore from '../stores/groupStore';
import LoadingError from '../components/loadingError';
import LoadingIndicator from '../components/loadingIndicator';
import PropTypes from '../proptypes';
import {t} from '../locale';

let ERROR_TYPES = {
  GROUP_NOT_FOUND: 'GROUP_NOT_FOUND'
};

const GroupDetails = React.createClass({
  propTypes: {
    setProjectNavSection: React.PropTypes.func,
    memberList: React.PropTypes.array
  },

  childContextTypes: {
    group: PropTypes.Group,
  },

  mixins: [
    ApiMixin,
    Reflux.listenTo(GroupStore, 'onGroupChange')
  ],

  getInitialState() {
    return {
      group: null,
      loading: true,
      error: false,
      errorType: null
    };
  },

  getChildContext() {
    return {
      group: this.state.group,
    };
  },

  componentWillMount() {
    this.props.setProjectNavSection('stream');
    this.fetchData();
  },

  remountComponent() {
    this.setState(this.getInitialState(), this.fetchData);
  },

  fetchData() {
    this.api.request(this.getGroupDetailsEndpoint(), {
      success: (data) => {
        this.setState({
          loading: false,
          error: false,
          errorType: null
        });
<commit_msg>Redirect group pages following a merge.<commit_after>import React from 'react';
import Reflux from 'reflux';
import ApiMixin from '../mixins/apiMixin';
import DocumentTitle from 'react-document-title';
import GroupHeader from './groupDetails/header';
import GroupStore from '../stores/groupStore';
import LoadingError from '../components/loadingError';
import LoadingIndicator from '../components/loadingIndicator';
import PropTypes from '../proptypes';
import {t} from '../locale';
import {History} from 'react-router';

let ERROR_TYPES = {
  GROUP_NOT_FOUND: 'GROUP_NOT_FOUND'
};

const GroupDetails = React.createClass({
  propTypes: {
    setProjectNavSection: React.PropTypes.func,
    memberList: React.PropTypes.array
  },

  childContextTypes: {
    group: PropTypes.Group,
  },

  mixins: [
    ApiMixin,
    History,
    Reflux.listenTo(GroupStore, 'onGroupChange')
  ],

  getInitialState() {
    return {
      group: null,
      loading: true,
      error: false,
      errorType: null
    };
  },

  getChildContext() {
    return {
      group: this.state.group,
    };
  },

  componentWillMount() {
    this.props.setProjectNavSection('stream');
    this.fetchData();
  },

  componentWillReceiveProps(nextProps) {
    if (nextProps.params.groupId !== this.props.params.groupId) {
      this.remountComponent();
    }
  },

  componentDidUpdate(prevProps, prevState) {
    if (prevProps.params.groupId !== this.props.params.groupId) {
      this.fetchData();
    }
  },

  remountComponent() {
    this.setState(this.getInitialState());
  },

  fetchData() {
    this.api.request(this.getGroupDetailsEndpoint(), {
      success: (data) => {
        // TODO: Ideally, this would rebuild the route before parameter
        // interpolation, replace the `groupId` field of `this.routeParams`,
        // and use `formatPattern` from `react-router` to rebuild the URL,
        // rather than blindly pattern matching like we do here. Unfortunately,
        // `formatPattern` isn't actually exported until `react-router` 2.0.1:
        // https://github.com/reactjs/react-router/blob/v2.0.1/modules/index.js#L25
        if (this.props.params.groupId != data.id) {
          let location = this.props.location;
          return void this.history.pushState(
            null,
            location.pathname.replace(
              `/issues/${this.props.params.groupId}/`,
              `/issues/${data.id}/`
            ) + location.search + location.hash
          );
        }

        this.setState({
          loading: false,
          error: false,
          errorType: null
        });

{'fraction_non_alphanumeric': 0.13082481933715426, 'fraction_numerical': 0.00199352105656616, 'mean_word_length': 2.8374760994263863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '6266240', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1181, 'n_words': 258}