<commit_before>class GroupAssignmentInvitationsController < ApplicationController
  layout 'layouts/invitations'

  before_action :check_group_not_previous_acceptee, only: [:show]
  before_action :check_user_not_group_member,       only: [:show]

  before_action :authorize_group_access, only: [:accept_invitation]

  def show
    @groups = invitation.groups.map { |group| [group.title, group.id] }
  end

  def accept
  end

  def accept_assignment
    users_group_assignment_repo = invitation.redeem_for(current_user, group)

    if users_group_assignment_repo.present?
      redirect_to successful_invitation_group_assignment_invitation_path
    else
      flash[:error] = 'An error has occured, please refresh the page and try again.'
      redirect_to :show
    end
  end

  def accept_invitation
    selected_group       = Group.find_by(id: group_params[:id])
    selected_group_title = group_params[:title]

    users_group_assignment_repo = invitation.redeem_for(current_user, selected_group, selected_group_title)

    if users_group_assignment_repo.present?
      redirect_to successful_invitation_group_assignment_invitation_path
    else
      flash[:error] = 'An error has occured, please refresh the page and try again.'
      redirect_to :show
    end
  end

  def successful_invitation
    not_found unless group_assignment_repo
  end

  private

  def required_scopes
    %w()
  end
<commit_msg>group assignments still require org admin<commit_after>class GroupAssignmentInvitationsController < ApplicationController
  layout 'layouts/invitations'

  before_action :check_group_not_previous_acceptee, only: [:show]
  before_action :check_user_not_group_member,       only: [:show]

  before_action :authorize_group_access, only: [:accept_invitation]

  def show
    @groups = invitation.groups.map { |group| [group.title, group.id] }
  end

  def accept
  end

  def accept_assignment
    users_group_assignment_repo = invitation.redeem_for(current_user, group)

    if users_group_assignment_repo.present?
      redirect_to successful_invitation_group_assignment_invitation_path
    else
      flash[:error] = 'An error has occured, please refresh the page and try again.'
      redirect_to :show
    end
  end

  def accept_invitation
    selected_group       = Group.find_by(id: group_params[:id])
    selected_group_title = group_params[:title]

    users_group_assignment_repo = invitation.redeem_for(current_user, selected_group, selected_group_title)

    if users_group_assignment_repo.present?
      redirect_to successful_invitation_group_assignment_invitation_path
    else
      flash[:error] = 'An error has occured, please refresh the page and try again.'
      redirect_to :show
    end
  end

  def successful_invitation
    not_found unless group_assignment_repo
  end

  private

  def required_scopes
    %w(admin:org)
  end

{'fraction_non_alphanumeric': 0.06046836770360014, 'fraction_numerical': 0.0, 'mean_word_length': 4.33955223880597, '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': '1215131', 'n_tokens_mistral': 882, 'n_tokens_neox': 853, 'n_words': 199}