<commit_before>Meteor.methods({
  validLink: function (inviterId, inviteCode) {
    return !!Invites.findOne({ 'inviterId': inviterId, 'inviteCode': inviteCode, 'accepted': false });
  },
  inviteUser: function (email) {
    var currentUser = Meteor.user();
    var inviterId = currentUser._id;

    // check that user can invite
    if (!canInvite(currentUser))
      throw new Meteor.Error('no-permission', 'This user does not have permission to continue.');

    // check that invited user doesn't exist
    if (Meteor.users.findOne({ 'emails': { $elemMatch: { 'address': email } } }))
      throw new Meteor.Error('duplicate-content', 'This content already exists.');

    // check that invited user hasn't been invited
    if (Invites.findOne({ 'invitedEmail': email }))
      throw new Meteor.Error('duplicate-content', 'This content already exists.');<commit_msg>Fix checking for invitation methods<commit_after>Meteor.methods({
  validLink: function (inviterId, inviteCode) {
    check(inviterId, String);
    check(inviteCode, String);

    return !!Invites.findOne({ 'inviterId': inviterId, 'inviteCode': inviteCode, 'accepted': false });
  },
  inviteUser: function (email) {
    check(email, String);

    var currentUser = Meteor.user();
    var inviterId = currentUser._id;

    // check that user can invite
    if (!canInvite(currentUser))
      throw new Meteor.Error('no-permission', 'This user does not have permission to continue.');

    // check that invited user doesn't exist
    if (Meteor.users.findOne({ 'emails': { $elemMatch: { 'address': email } } }))
      throw new Meteor.Error('duplicate-content', 'This content already exists.');

    // check that invited user hasn't been invited
    if (Invites.findOne({ 'invitedEmail': email }))
      throw new Meteor.Error('duplicate-content', 'This content already exists.');
{'fraction_non_alphanumeric': 0.13614262560777957, 'fraction_numerical': 0.0, 'mean_word_length': 3.9124668435013263, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5728412', 'n_tokens_mistral': 553, 'n_tokens_neox': 536, 'n_words': 163}