<commit_before>class FullAnimeController < ApplicationController
  before_action :authenticate_user!, except: [:show]

  def show
    anime = Anime.find params[:id]
    render json: anime, serializer: FullAnimeSerializer
  end

  def update
    Anime.find(params[:id]).create_pending(current_user, full_anime_params)
    render json: true
  end

  def destroy
    if current_user.admin?
      Anime.find(params[:id]).delay.destroy
      render json: true
    else
      error! 400
    end
  end

  private

  def full_anime_params
    params.require(:full_anime).permit(
      :synopsis, :episode_length, :episode_count, :poster_image,
      :cover_image, :cover_image_top_offset, :youtube_video_id
    )
  end
end<commit_msg>allow staff to edit directly<commit_after>class FullAnimeController < ApplicationController
  before_action :authenticate_user!, except: [:show]

  def show
    anime = Anime.find params[:id]
    render json: anime, serializer: FullAnimeSerializer
  end

  def update
    anime = Anime.find(params[:id])
    # if this user is admin, just update
    if current_user.admin?
      anime.update_attributes(full_anime_params)
    else
      anime.create_pending(current_user, full_anime_params)
    end
    render json: true
  end

  def destroy
    if current_user.admin?
      Anime.find(params[:id]).delay.destroy
      render json: true
    else
      error! 400
    end
  end

  private

  def full_anime_params
    params.require(:full_anime).permit(
      :synopsis, :episode_length, :episode_count, :poster_image,
      :cover_image, :cover_image_top_offset, :youtube_video_id
    )
  end
end
{'fraction_non_alphanumeric': 0.08143121529919803, 'fraction_numerical': 0.003701418877236274, 'mean_word_length': 3.518105849582173, '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': '2220576', 'n_tokens_mistral': 540, 'n_tokens_neox': 520, 'n_words': 121}