<commit_before>class Etikett::TagsController < ApplicationController
  def index
    @etiketts = Etikett::Tag.fetch(params)
    respond_to do |format|
      format.json {
        render json: @etiketts.collect{|e| {
          id: params[:real_object_id] == 'true' ? e.prime_id : e.id,
          text: e.name,
          locked: e.is_prime_for?(params[:taggable_type], params[:taggable_id]),
          klass: e.class.name.underscore.gsub(/\//, '_')}
        }, root: false
      }
    end
  end

  def create
    ActiveRecord::Base.transaction do<commit_msg>add possibility to check if user is allowed to use tag<commit_after>class Etikett::TagsController < ApplicationController
  def index
    @etiketts = Etikett::Tag.fetch(params)
    if current_user.respond_to?(:allowed_to_use_tag?)
      Array(@etiketts).select!{|tag| current_user.allowed_to_use_tag?(tag)}
    end
    respond_to do |format|
      format.json {
        render json: @etiketts.collect{|e| {
          id: params[:real_object_id] == 'true' ? e.prime_id : e.id,
          text: e.name,
          locked: e.is_prime_for?(params[:taggable_type], params[:taggable_id]),
          klass: e.class.name.underscore.gsub(/\//, '_')}
        }, root: false
      }
    end
  end

  def create
    ActiveRecord::Base.transaction do
{'fraction_non_alphanumeric': 0.13090627420604184, 'fraction_numerical': 0.0, 'mean_word_length': 2.87987987987988, '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': '1072242', 'n_tokens_mistral': 437, 'n_tokens_neox': 429, 'n_words': 82}