<commit_before>import { addFlagProperty } from 'discourse/controllers/header';

export default {
  name: 'add-akismet-count',

  initialize(container) {
    const user = container.lookup('current-user:main');

    if (user && user.get('staff')) {
      addFlagProperty('currentUser.akismet_review_count');

      const messageBus = container.lookup('message-bus:main');
      messageBus.subscribe("/akismet_counts", function(result) {
        if (result) {
          user.set('akismet_review_count', result.akismet_review_count || 0);
        }
      });
    }
  }
};<commit_msg>Add the flagged property before routes are mapped.<commit_after>import { addFlagProperty } from 'discourse/controllers/header';

export default {
  name: 'add-akismet-count',
  before: 'map-routes',

  initialize(container) {
    const user = container.lookup('current-user:main');

    if (user && user.get('staff')) {
      addFlagProperty('currentUser.akismet_review_count');

      const messageBus = container.lookup('message-bus:main');
      messageBus.subscribe("/akismet_counts", function(result) {
        if (result) {
          user.set('akismet_review_count', result.akismet_review_count || 0);
        }
      });
    }
  }
};
{'fraction_non_alphanumeric': 0.14273995077932733, 'fraction_numerical': 0.0016406890894175555, 'mean_word_length': 3.5522388059701493, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3956315', 'n_tokens_mistral': 378, 'n_tokens_neox': 370, 'n_words': 61}