<commit_before>class ListedTaxaController < ApplicationController
  before_filter :login_required, :except => [:show]
  before_filter :load_listed_taxon, :except => [:index, :create]
  cache_sweeper :listed_taxon_sweeper, :only => [:create, :update, :destroy]
  
  SHOW_PARTIALS = %w(place_tip guide)

  def index
    redirect_to lists_path
  end
  
  def show
    if partial = params[:partial]
      partial = "lists/listed_taxon" unless SHOW_PARTIALS.include?(partial)
      render :partial => partial, :layout => false
      return
    end
  end
  
  def create
    if params[:listed_taxon]
      @list = List.find_by_id(params[:listed_taxon][:list_id].to_i)
      @place = Place.find_by_id(params[:listed_taxon][:place_id].to_i) if params[:listed_taxon][:place_id]
      @taxon = Taxon.find_by_id(params[:listed_taxon][:taxon_id].to_i)
    else
      @list = List.find_by_id(params[:list_id].to_i)
      @place = Place.find_by_id(params[:place_id].to_i)
      @taxon = Taxon.find_by_id(params[:taxon_id].to_i)
    end
    @list ||= @place.check_list if @place
    
    unless @list && @list.editable_by?(current_user)
      flash[:notice] = "Sorry, you don't have permission to add to this list."<commit_msg>Bugfix: listed_taxa/show.json was... not there.<commit_after>class ListedTaxaController < ApplicationController
  before_filter :login_required, :except => [:show]
  before_filter :load_listed_taxon, :except => [:index, :create]
  cache_sweeper :listed_taxon_sweeper, :only => [:create, :update, :destroy]
  
  SHOW_PARTIALS = %w(place_tip guide)

  def index
    redirect_to lists_path
  end
  
  def show
    respond_to do |format|
      format.html do
        if partial = params[:partial]
          partial = "lists/listed_taxon" unless SHOW_PARTIALS.include?(partial)
          render :partial => partial, :layout => false
          return
        end
      end
      format.json { render :json => @listed_taxon }
    end
  end
  
  def create
    if params[:listed_taxon]
      @list = List.find_by_id(params[:listed_taxon][:list_id].to_i)
      @place = Place.find_by_id(params[:listed_taxon][:place_id].to_i) if params[:listed_taxon][:place_id]
      @taxon = Taxon.find_by_id(params[:listed_taxon][:taxon_id].to_i)
    else
      @list = List.find_by_id(params[:list_id].to_i)
      @place = Place.find_by_id(params[:place_id].to_i)
      @taxon = Taxon.find_by_id(params[:taxon_id].to_i)
    end
    @list ||= @place.check_list if @place
    
    unless @list && @list.editable_by?(current_user)
      flash[:notice] = "Sorry, you don't have permission to add to this list."
{'fraction_non_alphanumeric': 0.12442218798151002, 'fraction_numerical': 0.0, 'mean_word_length': 3.6962025316455698, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '3819916', 'n_tokens_mistral': 929, 'n_tokens_neox': 919, 'n_words': 176}