<commit_before>Template.server_info.events({
  'click button.stripe-button': function(e, t){
    // e = event, t = template
    e.preventDefault();

    var params = this;
    var rate = this.rate;

    var serverName = this.serverName;
    var serverOwner = this.serverOwner;

    console.log('Client rate ' + rate);
    var checkout = StripeCheckout.configure({
      key: 'pk_test_6pRNASCoBOKtIshFeQd4XMUh',
      image: 'https://i.imgur.com/ErLyYDo.jpg',
      token: function(token){
        Meteor.call('stripeCheckout', token, params, function(e, r){
          if(e){
            console.log('client ' + e);
          };
        });
      }
    });

    checkout.open({
      name: 'Plex Server Portal',
      description: 'Access to ' + serverName + ' owned by ' + serverOwner,
      amount: rate
    });
  }
});

Template.server_info.helpers({
  purchased: function(_id){
    // Return a boolean
    var currentUser = Meteor.userId();
    var currentServer = PlexCustomers.find({ $and: [{ userId: currentUser }, {serverId: _id}, { paymentSuccess: true }] }, { fields: { _id: 1 }});
    return currentServer.count() ? true : false;
  }
});<commit_msg>Removed template-specific helper 'purchased'<commit_after>Template.server_info.events({
  'click button.stripe-button': function(e, t){
    // e = event, t = template
    e.preventDefault();

    var params = this;
    var rate = this.rate;

    var serverName = this.serverName;
    var serverOwner = this.serverOwner;

    console.log('Client rate ' + rate);
    var checkout = StripeCheckout.configure({
      key: 'pk_test_6pRNASCoBOKtIshFeQd4XMUh',
      image: 'https://i.imgur.com/ErLyYDo.jpg',
      token: function(token){
        Meteor.call('stripeCheckout', token, params, function(e, r){
          if(e){
            console.log('client ' + e);
          };
        });
      }
    });

    checkout.open({
      name: 'Plex Server Portal',
      description: 'Access to ' + serverName + ' owned by ' + serverOwner,
      amount: rate
    });
  }
});
{'fraction_non_alphanumeric': 0.14688427299703263, 'fraction_numerical': 0.002472799208704253, 'mean_word_length': 2.6125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2962748', 'n_tokens_mistral': 667, 'n_tokens_neox': 649, 'n_words': 141}