<commit_before>/**
 * Form Media related actions
 */

import Reflux from 'reflux';
import {dataInterface} from 'js/dataInterface';
import {notify} from 'utils';

const FORM_MEDIA_FILE_TYPE = 'form_media';

const formMediaActions = Reflux.createActions({
  loadMedia: {children: ['completed', 'failed']},
  uploadMedia: {children: ['completed', 'failed']},
  deleteMedia: {children: ['completed', 'failed']},
});

formMediaActions.uploadMedia.listen((uid, formMediaJSON) => {
  dataInterface.postFormMedia(uid, formMediaJSON)
    .done(() => {
      formMediaActions.uploadMedia.completed(uid);
    })
    .fail(formMediaActions.uploadMedia.failed);
});
formMediaActions.uploadMedia.completed.listen((uid) => {
  formMediaActions.loadMedia(uid);
});
formMediaActions.uploadMedia.failed.listen(() => {
  alertify.error(t('Could not upload your media'));
});

formMediaActions.loadMedia.listen((uid) => {
  dataInterface.getAssetFiles(uid, FORM_MEDIA_FILE_TYPE)
    .done(formMediaActions.loadMedia.completed)
    .fail(formMediaActions.loadMedia.failed);
});
formMediaActions.loadMedia.failed.listen(() => {
  alertify.error(t('Something went wrong with getting your media'));
});

formMediaActions.deleteMedia.listen((uid, url) => {
  dataInterface.deleteFormMedia(url)
    .done(() => {
      formMediaActions.deleteMedia.completed(uid);
    })
    .fail(formMediaActions.deleteMedia.failed);
});
formMediaActions.deleteMedia.completed.listen((uid) => {
  notify(t('Successfully deleted media'));
  formMediaActions.loadMedia(uid);
});
formMediaActions.deleteMedia.failed.listen(() => {
  alertify.error(t('Failed to delete media!'));
});

export default formMediaActions;<commit_msg>PR Changes: fixed import mismatch<commit_after>/**
 * Form Media related actions
 */

import alertify from 'alertifyjs';
import Reflux from 'reflux';
import {dataInterface} from 'js/dataInterface';

const FORM_MEDIA_FILE_TYPE = 'form_media';

const formMediaActions = Reflux.createActions({
  loadMedia: {children: ['completed', 'failed']},
  uploadMedia: {children: ['completed', 'failed']},
  deleteMedia: {children: ['completed', 'failed']},
});

formMediaActions.uploadMedia.listen((uid, formMediaJSON) => {
  dataInterface.postFormMedia(uid, formMediaJSON)
    .done(() => {
      formMediaActions.uploadMedia.completed(uid);
    })
    .fail(formMediaActions.uploadMedia.failed);
});
formMediaActions.uploadMedia.completed.listen((uid) => {
  formMediaActions.loadMedia(uid);
});
formMediaActions.uploadMedia.failed.listen(() => {
  alertify.error(t('Could not upload your media'));
});

formMediaActions.loadMedia.listen((uid) => {
  dataInterface.getAssetFiles(uid, FORM_MEDIA_FILE_TYPE)
    .done(formMediaActions.loadMedia.completed)
    .fail(formMediaActions.loadMedia.failed);
});
formMediaActions.loadMedia.failed.listen(() => {
  alertify.error(t('Something went wrong with getting your media'));
});

formMediaActions.deleteMedia.listen((uid, url) => {
  dataInterface.deleteFormMedia(url)
    .done(() => {
      formMediaActions.deleteMedia.completed(uid);
    })
    .fail(formMediaActions.deleteMedia.failed);
});
formMediaActions.deleteMedia.completed.listen((uid) => {
  alertify.success(t('Successfully deleted media'));
  formMediaActions.loadMedia(uid);
});
formMediaActions.deleteMedia.failed.listen(() => {
  alertify.error(t('Failed to delete media!'));
});

export default formMediaActions;
{'fraction_non_alphanumeric': 0.15750808110490744, 'fraction_numerical': 0.0, 'mean_word_length': 5.890688259109312, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '5418422', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1018, 'n_words': 167}