<commit_before>ResendCancelInvitationMutation = GraphQL::Relay::Mutation.define do
  name 'ResendCancelInvitation'

  input_field :email, !types.String

  input_field :action, !types.String

  return_field :success, types.Boolean

  resolve -> (_root, inputs, _ctx) {
    user = User.where(email: inputs[:email]).last
    if user.nil?
      raise ActiveRecord::RecordNotFound
    else
      case inputs[:action]
      when 'cancel'
        User.cancel_user_invitation(user)
      when 'resend'
        tu = user.team_users.where(team_id: Team.current.id).last
        user.send_invitation_mail(tu)
      end
      { success: true }
    end
  }
end

<commit_msg>Ticket #7060 - update invitation date after resend it<commit_after>ResendCancelInvitationMutation = GraphQL::Relay::Mutation.define do
  name 'ResendCancelInvitation'

  input_field :email, !types.String

  input_field :action, !types.String

  return_field :success, types.Boolean

  resolve -> (_root, inputs, _ctx) {
    user = User.where(email: inputs[:email]).last
    if user.nil?
      raise ActiveRecord::RecordNotFound
    else
      case inputs[:action]
      when 'cancel'
        User.cancel_user_invitation(user)
      when 'resend'
        tu = user.team_users.where(team_id: Team.current.id).last
        user.send_invitation_mail(tu)
        # update invitations dates
        time = Time.now
        tu.update_columns(created_at: time)
        user.update_columns(invitation_created_at: time, invitation_sent_at: time) if user.invited_to_sign_up?
      end
      { success: true }
    end
  }
end


{'fraction_non_alphanumeric': 0.09708121827411167, 'fraction_numerical': 0.0025380710659898475, 'mean_word_length': 3.183023872679045, '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': '4437889', 'n_tokens_mistral': 502, 'n_tokens_neox': 490, 'n_words': 104}