<commit_before># frozen_string_literal: true

class TeamsController < ApplicationController
  before_action :set_user, only: [:index, :create]
  before_action :check_team_admin_rights, only: [:manage]

  def new
    @team = Team.new(create_team_params)
  end

  def create
    @team = TeamAdder.create(params, current_user)

    if @team.persisted?
      redirect_to dashboard_path(team: @team.slug)
    else
      render :new
    end
  end

  def manage
    @team = current_team
    @team_invite_submissions = TeamInviteForm.new
  end

  def update
    @team = current_team
    @team_invite_submissions = TeamInviteForm.new
    if @team.update(team_params)
      flash[:success] = 'Successfully updated team!'
      redirect_to manage_path(@team.slug)
    else
      render :manage
    end
  end

  private

  def set_user
    @user = current_user
  end

  def check_restricted
    redirect_to root_url if current_user.restricted?
  end

  def create_team_params
    params.permit(:name)
  end

  def team_params
    params.permit(:name, :slug, :general_info, :logo)
  end
end<commit_msg>Removed slug from manage form<commit_after># frozen_string_literal: true

class TeamsController < ApplicationController
  before_action :set_user, only: [:index, :create]
  before_action :check_team_admin_rights, only: [:manage]

  def new
    @team = Team.new(create_team_params)
  end

  def create
    @team = TeamAdder.create(params, current_user)

    if @team.persisted?
      redirect_to dashboard_path(team: @team.slug)
    else
      render :new
    end
  end

  def manage
    @team = current_team
    @team_invite_submissions = TeamInviteForm.new
  end

  def update
    @team = current_team
    @team_invite_submissions = TeamInviteForm.new
    if @team.update(team_params)
      flash[:success] = 'Successfully updated team!'
      redirect_to manage_path(@team.slug)
    else
      render :manage
    end
  end

  private

  def set_user
    @user = current_user
  end

  def check_restricted
    redirect_to root_url if current_user.restricted?
  end

  def create_team_params
    params.permit(:name)
  end

  def team_params
    params.permit(:name, :general_info, :logo)
  end
end
{'fraction_non_alphanumeric': 0.07590306355738455, 'fraction_numerical': 0.0, 'mean_word_length': 3.376, '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': '1990412', 'n_tokens_mistral': 752, 'n_tokens_neox': 713, 'n_words': 174}