<commit_before>class UserController < ApplicationController
  def bookmark_contents
    data = client.bookmark_contents(page_params)
    @contents = data.contents
  end

  def watchkeyword_contents
    data = client.watchkeyword_contents(page_params)
    @contents = data.contents
  end

  def friend_recommends
    data = client.friend_recommends(page_params)
    @contents = data.contents
  end

  def collections
    data = client.collections(page_params)
    @contents = data.contents
  end

  def bookmarks
    data = client.bookmarks
    @creators = data.creators
  end

  def support
    handle_remote do
      client.support(params[:cont_id])
      render text: nil
    end
  end

  def add_collection
    handle_remote do
      client.add_collection(params[:cont_id])
      render text: nil
    end
  end

  def add_bookmark
    handle_remote do
      client.add_bookmark(params[:prof_id])
      render text: nil
    end
  end

  def comments
  end

  def add_comment
  end

  def remove_comment
  end

  private
  def handle_remote
    begin
      yield
    rescue TINAMI::Error => e
      logger.info e
      render text: e.message, status: 400
    end
  end

end
<commit_msg>Add authenticate filter to user actions.<commit_after>class UserController < ApplicationController
  before_filter :authenticate, except: [:comments]

  def bookmark_contents
    data = client.bookmark_contents(page_params)
    @contents = data.contents
  end

  def watchkeyword_contents
    data = client.watchkeyword_contents(page_params)
    @contents = data.contents
  end

  def friend_recommends
    data = client.friend_recommends(page_params)
    @contents = data.contents
  end

  def collections
    data = client.collections(page_params)
    @contents = data.contents
  end

  def bookmarks
    data = client.bookmarks
    @creators = data.creators
  end

  def support
    handle_remote do
      client.support(params[:cont_id])
      render text: nil
    end
  end

  def add_collection
    handle_remote do
      client.add_collection(params[:cont_id])
      render text: nil
    end
  end

  def add_bookmark
    handle_remote do
      client.add_bookmark(params[:prof_id])
      render text: nil
    end
  end

  def comments
  end

  def add_comment
  end

  def remove_comment
  end

  private
  def authenticate
    redirect_to :login unless authenticated?
  end

  def handle_remote
    begin
      yield
    rescue TINAMI::Error => e
      logger.info e
      render text: e.message, status: 400
    end
  end

end

{'fraction_non_alphanumeric': 0.05665610142630745, 'fraction_numerical': 0.002377179080824089, 'mean_word_length': 2.837386018237082, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6699419', 'n_tokens_mistral': 795, 'n_tokens_neox': 762, 'n_words': 206}