<commit_before>import { call, put } from 'redux-saga/effects';
import {
  ReturnHitRequest,
  ReturnHitFailure,
  returnHitFailure,
  ReturnHitSuccess,
  returnHitSuccess
} from '../actions/return';
import { sendReturnHitRequest } from '../api/returnHit';
import {
  generateReturnToast,
  createGenericWaitingToast,
  updateTopRightToaster
} from '../utils/toaster';
import { getHitAuthToken } from '../api/getHitAuthToken';

export function* returnHit(action: ReturnHitRequest) {
  const { title, hitId } = action.queueItem;
  const toasterKey = createGenericWaitingToast(`Returning "${title}" ...`);

  try {
    const authToken: string | null = yield call(
      getHitAuthToken,
      action.queueItem
    );

    if (!authToken) {
      updateTopRightToaster(toasterKey, generateReturnToast(false, title));
      return yield put<ReturnHitFailure>(returnHitFailure());
    }

    const successful: boolean = yield call(
      sendReturnHitRequest,
      action.queueItem,
      authToken
    );
    updateTopRightToaster(toasterKey, generateReturnToast(successful, title));

    return successful
      ? yield put<ReturnHitSuccess>(returnHitSuccess(hitId))
      : yield put<ReturnHitFailure>(returnHitFailure());
  } catch (e) {
    console.warn(e);
    updateTopRightToaster(toasterKey, generateReturnToast(false, title));
    yield put<ReturnHitFailure>(returnHitFailure());
  }
}
<commit_msg>Returning HIT waiting toast no longer shows full HIT title.<commit_after>import { call, put } from 'redux-saga/effects';
import {
  ReturnHitRequest,
  ReturnHitFailure,
  returnHitFailure,
  ReturnHitSuccess,
  returnHitSuccess
} from '../actions/return';
import { sendReturnHitRequest } from '../api/returnHit';
import {
  generateReturnToast,
  createGenericWaitingToast,
  updateTopRightToaster
} from '../utils/toaster';
import { getHitAuthToken } from '../api/getHitAuthToken';

export function* returnHit(action: ReturnHitRequest) {
  const { title, hitId } = action.queueItem;
  const toasterKey = createGenericWaitingToast(`Returning HIT...`);

  try {
    const authToken: string | null = yield call(
      getHitAuthToken,
      action.queueItem
    );

    if (!authToken) {
      updateTopRightToaster(toasterKey, generateReturnToast(false, title));
      return yield put<ReturnHitFailure>(returnHitFailure());
    }

    const successful: boolean = yield call(
      sendReturnHitRequest,
      action.queueItem,
      authToken
    );
    updateTopRightToaster(toasterKey, generateReturnToast(successful, title));

    return successful
      ? yield put<ReturnHitSuccess>(returnHitSuccess(hitId))
      : yield put<ReturnHitFailure>(returnHitFailure());
  } catch (e) {
    console.warn(e);
    updateTopRightToaster(toasterKey, generateReturnToast(false, title));
    yield put<ReturnHitFailure>(returnHitFailure());
  }
}

{'fraction_non_alphanumeric': 0.10755616065350579, 'fraction_numerical': 0.0, 'mean_word_length': 3.635646687697161, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6401066', 'n_tokens_mistral': 852, 'n_tokens_neox': 838, 'n_words': 171}