<commit_before>import * as React from 'react';
import * as _ from 'lodash';
import {
  Dialog,
  FlatButton,
  RaisedButton,
} from 'material-ui';
import Reaction from './Reaction';
import ContactForm from './ContactForm';
import NetworkError from '../Dialogs/NetworkError';
import Raido from '../Raido';
import i from '../i18n';
import { contact } from './api';

interface props {
  type: string;
  title?: string;
  button: any;
  success: object;
  message?: Function;
}

export default class Contact extends React.Component<props, any> {
  formsy: any;
  state = {
    open: false,
    wait: false,
    canSubmit: false,
    openDialog: false,
    networkErr: false,
  }

  submit = (data) => {
    const body = this.props.message && this.props.message();
    this.setState({ wait: true });
    contact({ ...data, body, type: this.props.type })
      .then((res) => {
        if (res && res['err']) return this.setState({ networkErr: true, wait: false });
        this.setState({
          wait: false,
          open: false,
          openDialog: true,<commit_msg>Sending lang code on contact request<commit_after>import * as React from 'react';
import * as _ from 'lodash';
import {
  Dialog,
  FlatButton,
  RaisedButton,
} from 'material-ui';
import Reaction from './Reaction';
import ContactForm from './ContactForm';
import NetworkError from '../Dialogs/NetworkError';
import Raido from '../Raido';
import i from '../i18n';
import { contact } from './api';

interface props {
  type: string;
  title?: string;
  button: any;
  success: object;
  message?: Function;
}

export default class Contact extends React.Component<props, any> {
  formsy: any;
  state = {
    open: false,
    wait: false,
    canSubmit: false,
    openDialog: false,
    networkErr: false,
  }

  submit = (data) => {
    const body = this.props.message && this.props.message();
    this.setState({ wait: true });
    contact({ ...data, body, type: this.props.type, code: i() })
      .then((res) => {
        if (res && res['err']) return this.setState({ networkErr: true, wait: false });
        this.setState({
          wait: false,
          open: false,
          openDialog: true,
{'fraction_non_alphanumeric': 0.14732965009208104, 'fraction_numerical': 0.001841620626151013, 'mean_word_length': 3.0092250922509227, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7453634', 'n_tokens_mistral': 666, 'n_tokens_neox': 659, 'n_words': 210}