<commit_before># The mentions plugin takes care of highlighting the @useranme and passing the users to the atwho plugin.
# The show_activities addMessage method is the responsible of changing the look of a message body when a user is mentioned
class Kandan.Plugins.Mentions
  @options:
    regex: /@\S*/g

    template: _.template '''<span class="mention"><%= mention %></span>'''

  @init: ()->
  	Kandan.Data.ActiveUsers.registerCallback "change", (data)=>
      @initUsersMentions(data.extra.active_users)

    Kandan.Modifiers.register @options.regex, (message, state) =>
      for mention in message.content.match(@options.regex)
      	replacement = @options.template({mention: mention})
      	message.content = message.content.replace(mention, replacement)

      return Kandan.Helpers.Activities.buildFromMessageTemplate(message)	
      
  @initUsersMentions: (activeUsers)->
  	users = _.map activeUsers, (user)->
  		user.username<commit_msg>Fixed mentions regex to stop matching email addresses<commit_after># The mentions plugin takes care of highlighting the @useranme and passing the users to the atwho plugin.
# The show_activities addMessage method is the responsible of changing the look of a message body when a user is mentioned
class Kandan.Plugins.Mentions
  @options:
    regex: /\B@\S+/g

    template: _.template '''<span class="mention"><%= mention %></span>'''

  @init: ()->
  	Kandan.Data.ActiveUsers.registerCallback "change", (data)=>
      @initUsersMentions(data.extra.active_users)

    Kandan.Modifiers.register @options.regex, (message, state) =>
      for mention in message.content.match(@options.regex)
      	replacement = @options.template({mention: mention})
      	message.content = message.content.replace(mention, replacement)

      return Kandan.Helpers.Activities.buildFromMessageTemplate(message)	
      
  @initUsersMentions: (activeUsers)->
  	users = _.map activeUsers, (user)->
  		user.username
{'fraction_non_alphanumeric': 0.11242299794661191, 'fraction_numerical': 0.0, 'mean_word_length': 4.142480211081794, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '2399494', 'n_tokens_mistral': 576, 'n_tokens_neox': 560, 'n_words': 160}