<commit_before>class GroupInviter
  class InvitationLimitExceededError < Exception; end

  def initialize(group:, inviter: User.helper_bot, user_ids: [], emails: [], invited_group_ids: [])
    @group    = group
    @inviter  = inviter
    @user_ids = Array(user_ids)
    @emails   = Array(emails)
    @invited_group_ids = Array(invited_group_ids)
  end

  def invite!<commit_msg>guard againsts clients mixing up emails and user_ids in announcements (#6315)<commit_after>class GroupInviter
  class InvitationLimitExceededError < Exception; end

  def initialize(group:, inviter: User.helper_bot, user_ids: [], emails: [], invited_group_ids: [])
    @group    = group
    @inviter  = inviter
    # seems like the two arrays get mixed up sometimes, let's sort them out
    @emails = Array(emails).concat(Array(user_ids)).filter   {|val| val.to_s.include?('@')}
    @user_ids = Array(emails).concat(Array(user_ids)).reject {|val| val.to_s.include?('@')}
    @invited_group_ids = Array(invited_group_ids)
  end

  def invite!
{'fraction_non_alphanumeric': 0.11960784313725491, 'fraction_numerical': 0.00392156862745098, 'mean_word_length': 4.579234972677596, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7361592', 'n_tokens_mistral': 347, 'n_tokens_neox': 333, 'n_words': 78}