<commit_before>#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3.  See
#   the COPYRIGHT file.

class ApplicationController < ActionController::Base

  protect_from_forgery :except => :receive

  before_filter :set_friends_and_status, :except => [:create, :update]
  before_filter :count_requests
  before_filter :fb_user_info

  layout :layout_by_resource

  def layout_by_resource
    if devise_controller?
      "session_wall"
    else
      "application"
    end
  end

  def set_friends_and_status
    if current_user
      if params[:action] == 'public'
        @aspect = :public
      elsif params[:aspect] == nil || params[:aspect] == 'all'
        @aspect = :all
      else
        @aspect = current_user.aspect_by_id( params[:aspect])
      end

      @aspects = current_user.aspects
      @friends = current_user.friends
    end
  end

  def count_requests
    @request_count = Request.for_user(current_user).size if current_user
  end

  def fb_user_info
    @access_token = env['warden'].session[:access_token]
    @logged_in = @access_token.present?<commit_msg>checking that a user is logged in before doing fb checking<commit_after>#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3.  See
#   the COPYRIGHT file.

class ApplicationController < ActionController::Base

  protect_from_forgery :except => :receive

  before_filter :set_friends_and_status, :except => [:create, :update]
  before_filter :count_requests
  before_filter :fb_user_info

  layout :layout_by_resource

  def layout_by_resource
    if devise_controller?
      "session_wall"
    else
      "application"
    end
  end

  def set_friends_and_status
    if current_user
      if params[:action] == 'public'
        @aspect = :public
      elsif params[:aspect] == nil || params[:aspect] == 'all'
        @aspect = :all
      else
        @aspect = current_user.aspect_by_id( params[:aspect])
      end

      @aspects = current_user.aspects
      @friends = current_user.friends
    end
  end

  def count_requests
    @request_count = Request.for_user(current_user).size if current_user
  end

  def fb_user_info
    if current_user
      @access_token = env['warden'].session[:access_token]
      @logged_in = @access_token.present?
    end
{'fraction_non_alphanumeric': 0.08400509121764956, 'fraction_numerical': 0.004242681374628765, 'mean_word_length': 3.3345588235294117, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7307940', 'n_tokens_mistral': 772, 'n_tokens_neox': 729, 'n_words': 188}