<commit_before># -*- encoding: utf-8 -*-

require 'digest/sha1'

class CfMessagesController < ApplicationController
  authorize_action([:show, :show_header, :versions]) { authorize_forum(permission: :read?) }
  authorize_action([:new, :create, :edit, :update]) { authorize_forum(permission: :write?) }
  authorize_action([:destroy, :restore]) { authorize_forum(permission: :moderator?) }
  authorize_action([:show_retag, :retag]) { may?(RightsHelper::RETAG) }

  include TagsHelper
  include MentionsHelper

  SHOW_NEW_MESSAGE     = "show_new_message"
  SHOW_MESSAGE         = "show_message"
  SHOW_THREAD          = "show_thread"

  CREATING_NEW_MESSAGE = "creating_new_message"
  CREATED_NEW_MESSAGE  = "created_new_message"

  UPDATING_MESSAGE     = "updating_message"
  UPDATED_MESSAGE      = "updated_message"

  DELETING_MESSAGE     = "deleting_message"
  DELETED_MESSAGE      = "deleted_message"

  RESTORING_MESSAGE    = "restoring_message"
  RESTORED_MESSAGE     = "restored_message"

  def show
    @thread, @message, @id = get_thread_w_post

    if not current_forum.blank? and @message.forum_id != current_forum.forum_id
      redirect_to cf_message_url(@thread, @message), status: 301
      return
    end

    @parent = @message.parent_level

    # parameter overwrites cookie overwrites config; validation
    # overwrites everything
    @read_mode = uconf('standard_view')
    @read_mode = cookies[:cf_readmode] if not cookies[:cf_readmode].blank? and not current_user.blank?
    @read_mode = params[:rm] unless params[:rm].blank?
    @read_mode = 'thread-view' unless %w(thread-view nested-view).include?(@read_mode)

    if not params[:rm].blank? and current_user.blank?
      cookies[:cf_readmode] = {value: @read_mode, expires: 1.year.from_now}
    end
<commit_msg>fix: correctly read cookie value for read mode<commit_after># -*- encoding: utf-8 -*-

require 'digest/sha1'

class CfMessagesController < ApplicationController
  authorize_action([:show, :show_header, :versions]) { authorize_forum(permission: :read?) }
  authorize_action([:new, :create, :edit, :update]) { authorize_forum(permission: :write?) }
  authorize_action([:destroy, :restore]) { authorize_forum(permission: :moderator?) }
  authorize_action([:show_retag, :retag]) { may?(RightsHelper::RETAG) }

  include TagsHelper
  include MentionsHelper

  SHOW_NEW_MESSAGE     = "show_new_message"
  SHOW_MESSAGE         = "show_message"
  SHOW_THREAD          = "show_thread"

  CREATING_NEW_MESSAGE = "creating_new_message"
  CREATED_NEW_MESSAGE  = "created_new_message"

  UPDATING_MESSAGE     = "updating_message"
  UPDATED_MESSAGE      = "updated_message"

  DELETING_MESSAGE     = "deleting_message"
  DELETED_MESSAGE      = "deleted_message"

  RESTORING_MESSAGE    = "restoring_message"
  RESTORED_MESSAGE     = "restored_message"

  def show
    @thread, @message, @id = get_thread_w_post

    if not current_forum.blank? and @message.forum_id != current_forum.forum_id
      redirect_to cf_message_url(@thread, @message), status: 301
      return
    end

    @parent = @message.parent_level

    # parameter overwrites cookie overwrites config; validation
    # overwrites everything
    @read_mode = uconf('standard_view')
    @read_mode = cookies[:cf_readmode] if not cookies[:cf_readmode].blank? and current_user.blank?
    @read_mode = params[:rm] unless params[:rm].blank?
    @read_mode = 'thread-view' unless %w(thread-view nested-view).include?(@read_mode)

    if not params[:rm].blank? and current_user.blank?
      cookies[:cf_readmode] = {value: @read_mode, expires: 1.year.from_now}
    end

{'fraction_non_alphanumeric': 0.11141983884412336, 'fraction_numerical': 0.0033342595165323703, 'mean_word_length': 4.462822458270106, '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': '4140165', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1159, 'n_words': 228}