<commit_before>module Thredded
  class TopicsController < Thredded::ApplicationController
    helper_method :current_page, :topic, :user_topic
    before_filter :update_user_activity

    def index
      authorize_reading messageboard

      @topics = topics
    end

    def show
      authorize! :read, topic

      @posts = topic.posts
        .includes(:user, :messageboard, :attachments)
        .order('id ASC')
        .page(current_page)

      @post  = messageboard.posts.build(postable: topic)

      update_read_status!
    end

    def search
      @topics = Topic.search(params[:q], messageboard)
    end

    def new
      @new_topic = TopicForm.new(messageboard: messageboard)
      authorize_creating @new_topic.topic<commit_msg>[JRO] Build new post with the messageboard's filter<commit_after>module Thredded
  class TopicsController < Thredded::ApplicationController
    helper_method :current_page, :topic, :user_topic
    before_filter :update_user_activity

    def index
      authorize_reading messageboard

      @topics = topics
    end

    def show
      authorize! :read, topic

      @posts = topic.posts
        .includes(:user, :messageboard, :attachments)
        .order('id ASC')
        .page(current_page)

      @post  = messageboard.posts.build(
        postable: topic,
        filter: messageboard.filter
      )

      update_read_status!
    end

    def search
      @topics = Topic.search(params[:q], messageboard)
    end

    def new
      @new_topic = TopicForm.new(messageboard: messageboard)
      authorize_creating @new_topic.topic
{'fraction_non_alphanumeric': 0.08096141682479444, 'fraction_numerical': 0.0, 'mean_word_length': 2.849148418491484, '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': '5386364', 'n_tokens_mistral': 483, 'n_tokens_neox': 460, 'n_words': 107}