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

class HighlightPlugin < Plugin
  def show_threadlist(threads)
    return unless current_user

    highlighted_users = uconf('highlighted_users')
    highlighted_users ||= ''
    highlight_self = uconf('highlight_self') == 'yes'

    return if highlighted_users.blank? and not highlight_self

    user_map = {}
    highlighted_users.split(',').each do |s|
      user_map[s.strip.downcase] = true
    end

    cu_nam = current_user.username.strip.downcase

    threads.each do |t|
      t.sorted_messages.each do |m|
        n = m.author.strip.downcase

        if user_map[n]
          m.attribs['classes'] << 'highlighted-user'
          m.attribs['classes'] << m.owner.to_class_name
        end

        if highlight_self and n == cu_nam
          m.attribs['classes'] << 'highlighted-self'
          m.attribs['classes'] << m.owner.to_class_name
        end
      end
    end
  end
  alias show_archive_threadlist show_threadlist
  alias show_invisible_threadlist show_threadlist
  alias show_interesting_threadlist show_threadlist

  def show_message(thread, message, votes)
    show_threadlist([thread])
  end
  alias show_new_message show_message

  def show_thread(thread, message, votes)
    show_threadlist([thread])
  end

  def showing_settings(user)
    users = CfUser.where(username: user.conf('highlighted_users').split(/\s*,\s*/))
    set('highlighted_users_list', users)
  end<commit_msg>fix: do not use message.owner<commit_after># -*- coding: utf-8 -*-

class HighlightPlugin < Plugin
  include ApplicationHelper

  def show_threadlist(threads)
    return unless current_user

    highlighted_users = uconf('highlighted_users')
    highlighted_users ||= ''
    highlight_self = uconf('highlight_self') == 'yes'

    return if highlighted_users.blank? and not highlight_self

    user_map = {}
    highlighted_users.split(',').each do |s|
      user_map[s.strip.downcase] = true
    end

    cu_nam = current_user.username.strip.downcase

    threads.each do |t|
      t.sorted_messages.each do |m|
        n = m.author.strip.downcase

        if user_map[n]
          m.attribs['classes'] << 'highlighted-user'
          m.attribs['classes'] << user_to_class_name(m.author)
        end

        if highlight_self and n == cu_nam
          m.attribs['classes'] << 'highlighted-self'
          m.attribs['classes'] << user_to_class_name(m.author)
        end
      end
    end
  end
  alias show_archive_threadlist show_threadlist
  alias show_invisible_threadlist show_threadlist
  alias show_interesting_threadlist show_threadlist

  def show_message(thread, message, votes)
    show_threadlist([thread])
  end
  alias show_new_message show_message

  def show_thread(thread, message, votes)
    show_threadlist([thread])
  end

  def showing_settings(user)
    users = CfUser.where(username: user.conf('highlighted_users').split(/\s*,\s*/))
    set('highlighted_users_list', users)
  end
{'fraction_non_alphanumeric': 0.10526315789473684, 'fraction_numerical': 0.0006791171477079797, 'mean_word_length': 3.2882096069868996, 'pattern_counts': {'":': 0, '<': 21, '<?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': '4813840', 'n_tokens_mistral': 960, 'n_tokens_neox': 926, 'n_words': 189}