<commit_before>'use strict';

module.exports = function renderReplyText() {
  return (req, res, next) => {
    if (req.reply.text) {
      return next();
    }

    if (req.campaign) {
      req.reply.text = req.campaign[req.reply.template];

      return next();
    }

    // TODO: Set this as a config variable.
    req.reply.template = 'noCampaignMessage';
    req.reply.text = 'Sorry, I\'m not sure how to respond to that.\n\nSay MENU to find a Campaign to join.';
    return next();
  };
};<commit_msg>Gets noReply working again<commit_after>'use strict';

module.exports = function renderReplyText() {
  return (req, res, next) => {
    // If we haven't rendered text yet, this is a campaign message except for edge-case when our
    // template === noReply -- in that case our text is set to empty string.
    if (req.reply.text || req.reply.template === 'noReply') {
      return next();
    }

    if (req.campaign) {
      req.reply.text = req.campaign[req.reply.template];

      return next();
    }

    // TODO: Set this as a config variable.
    req.reply.template = 'noCampaignMessage';
    req.reply.text = 'Sorry, I\'m not sure how to respond to that.\n\nSay MENU to find a Campaign to join.';
    return next();
  };
};
{'fraction_non_alphanumeric': 0.13720742534301855, 'fraction_numerical': 0.0, 'mean_word_length': 2.6904761904761907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7131730', 'n_tokens_mistral': 395, 'n_tokens_neox': 381, 'n_words': 127}