<commit_before># Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :layout
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
  before_filter :app_setup_check
  before_filter :authenticate_user!, unless: :devise_controller?
  skip_before_filter :authenticate_user!, only: [:update_cart, :empty_cart]
  before_filter :cart, unless: :devise_controller?

  with_options unless: lambda { |u| User.count == 0 } do |c|
    c.before_filter :load_configs
    c.before_filter :seen_app_configs
    # c.before_filter :first_time_user
    c.before_filter :fix_cart_date
    c.before_filter :set_view_mode
    c.before_filter :check_view_mode
    c.before_filter :make_cart_compatible
  end

  helper_method :cart

  rescue_from CanCan::AccessDenied do |exception|<commit_msg>allow guests to view terms of service<commit_after># Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :layout
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
  before_filter :app_setup_check
  before_filter :authenticate_user!, unless: :devise_controller?
  skip_before_filter :authenticate_user!, only: [:update_cart, :empty_cart, :terms_of_service]
  before_filter :cart, unless: :devise_controller?

  with_options unless: lambda { |u| User.count == 0 } do |c|
    c.before_filter :load_configs
    c.before_filter :seen_app_configs
    # c.before_filter :first_time_user
    c.before_filter :fix_cart_date
    c.before_filter :set_view_mode
    c.before_filter :check_view_mode
    c.before_filter :make_cart_compatible
  end

  helper_method :cart

  rescue_from CanCan::AccessDenied do |exception|
{'fraction_non_alphanumeric': 0.06819338422391857, 'fraction_numerical': 0.0010178117048346056, 'mean_word_length': 5.553333333333334, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7576727', 'n_tokens_mistral': 605, 'n_tokens_neox': 582, 'n_words': 162}