<commit_before># name: discourse-anonymous-categories
# about: Always-anonymous categories for Discourse
# version: 0.0.1
# authors: <NAME>
# url: https://githiub.com/JaredReisinger/discourse-anonymous-categories

enabled_site_setting :anonymous_categories_enabled

after_initialize do

  @anon_handler = lambda do |manager|
    if SiteSetting.anonymous_categories.include?(manager.args[:category])
      user = manager.user
      args = manager.args

      # Jump around the global anonymous setting for this post...
      shadow = nil
      if (shadow_id = user.custom_fields["shadow_id"].to_i) > 0
        shadow = User.find_by(id: shadow_id)

        if shadow && shadow.post_count > 0 &&
            shadow.last_posted_at < SiteSetting.anonymous_account_duration_minutes.minutes.ago
          shadow = nil
        end<commit_msg>Fix GitHub link<commit_after># name: discourse-anonymous-categories
# about: Always-anonymous categories for Discourse
# version: 0.0.1
# authors: <NAME>
# url: https://github.com/JaredReisinger/discourse-anonymous-categories

enabled_site_setting :anonymous_categories_enabled

after_initialize do

  @anon_handler = lambda do |manager|
    if SiteSetting.anonymous_categories.include?(manager.args[:category])
      user = manager.user
      args = manager.args

      # Jump around the global anonymous setting for this post...
      shadow = nil
      if (shadow_id = user.custom_fields["shadow_id"].to_i) > 0
        shadow = User.find_by(id: shadow_id)

        if shadow && shadow.post_count > 0 &&
            shadow.last_posted_at < SiteSetting.anonymous_account_duration_minutes.minutes.ago
          shadow = nil
        end
{'fraction_non_alphanumeric': 0.09346914319952067, 'fraction_numerical': 0.005991611743559017, 'mean_word_length': 3.453333333333333, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '4453945', 'n_tokens_mistral': 503, 'n_tokens_neox': 481, 'n_words': 111}