<commit_before>class InvitesController < ApplicationController
  
  before_filter :login_required
  
  def new
    raise ActiveRecord::NotFound if current_user.can_invite?
  end
  
  def create
    if current_user.can_invite?
      @invite = Invite.create(params[:invite].merge(:user_id => current_user.id))
      flash[:notice] = "The invite was created." # and will be sent as soon as three other users approve. 
    end
    redirect_to root_path
  end
  
  def approve
    @invite = Invite.find(params[:id])
    if @invite.approve(current_user)
      flash[:notice] = "The invite was approved"
    else
      
    end
    
    redirect_to root_path
  end
  <commit_msg>fixed that only some users can send invites<commit_after>class InvitesController < ApplicationController
  
  before_filter :login_required
  
  def new
    raise ActiveRecord::NotFound unless current_user.can_invite?
  end
  
  def create
    if current_user.can_invite?
      @invite = Invite.create(params[:invite].merge(:user_id => current_user.id))
      flash[:notice] = "The invite was created." # and will be sent as soon as three other users approve. 
    end
    redirect_to root_path
  end
  
  def approve
    @invite = Invite.find(params[:id])
    if @invite.approve(current_user)
      flash[:notice] = "The invite was approved"
    else
      
    end
    
    redirect_to root_path
  end
  
{'fraction_non_alphanumeric': 0.07692307692307693, 'fraction_numerical': 0.0, 'mean_word_length': 3.0558823529411763, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3088675', 'n_tokens_mistral': 433, 'n_tokens_neox': 425, 'n_words': 117}